Browse Source

fix race in daemon test framework

Signed-off-by: Tibor Vass <teabee89@gmail.com>
Tibor Vass 10 years ago
parent
commit
defe01daf8
1 changed files with 5 additions and 3 deletions
  1. 5 3
      integration-cli/docker_utils.go

+ 5 - 3
integration-cli/docker_utils.go

@@ -90,14 +90,16 @@ func (d *Daemon) Start(arg ...string) error {
 		return fmt.Errorf("Could not start daemon container: %v", err)
 	}
 
-	d.wait = make(chan error)
+	wait := make(chan error)
 
 	go func() {
-		d.wait <- d.cmd.Wait()
+		wait <- d.cmd.Wait()
 		d.t.Log("exiting daemon")
-		close(d.wait)
+		close(wait)
 	}()
 
+	d.wait = wait
+
 	tick := time.Tick(500 * time.Millisecond)
 	// make sure daemon is ready to receive requests
 	for {