Browse code

fix race in daemon test framework

Signed-off-by: Tibor Vass <teabee89@gmail.com>

Tibor Vass authored on 2014/09/04 07:56:58
Showing 1 changed files
... ...
@@ -90,14 +90,16 @@ func (d *Daemon) Start(arg ...string) error {
90 90
 		return fmt.Errorf("Could not start daemon container: %v", err)
91 91
 	}
92 92
 
93
-	d.wait = make(chan error)
93
+	wait := make(chan error)
94 94
 
95 95
 	go func() {
96
-		d.wait <- d.cmd.Wait()
96
+		wait <- d.cmd.Wait()
97 97
 		d.t.Log("exiting daemon")
98
-		close(d.wait)
98
+		close(wait)
99 99
 	}()
100 100
 
101
+	d.wait = wait
102
+
101 103
 	tick := time.Tick(500 * time.Millisecond)
102 104
 	// make sure daemon is ready to receive requests
103 105
 	for {