Browse code

Fix race condition in API commit test

Signed-off-by: Doug Davis <dug@us.ibm.com>

Doug Davis authored on 2015/04/25 21:46:47
Showing 1 changed files
... ...
@@ -614,14 +614,14 @@ func (s *DockerSuite) TestContainerApiTop(c *check.C) {
614 614
 }
615 615
 
616 616
 func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
617
-	out, err := exec.Command(dockerBinary, "run", "-d", "busybox", "/bin/sh", "-c", "touch /test").CombinedOutput()
617
+	cName := "testapicommit"
618
+	out, err := exec.Command(dockerBinary, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test").CombinedOutput()
618 619
 	if err != nil {
619 620
 		c.Fatal(err, out)
620 621
 	}
621
-	id := strings.TrimSpace(string(out))
622 622
 
623 623
 	name := "testcommit" + stringid.GenerateRandomID()
624
-	status, b, err := sockRequest("POST", "/commit?repo="+name+"&testtag=tag&container="+id, nil)
624
+	status, b, err := sockRequest("POST", "/commit?repo="+name+"&testtag=tag&container="+cName, nil)
625 625
 	c.Assert(status, check.Equals, http.StatusCreated)
626 626
 	c.Assert(err, check.IsNil)
627 627