ソースを参照

Fix race with TestContainerApiCommit

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Brian Goff 10 年 前
コミット
563708d78d

+ 2 - 2
integration-cli/docker_api_containers_test.go

@@ -625,7 +625,7 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
 	}
 	id := strings.TrimSpace(string(out))
 
-	name := "testcommit"
+	name := "testcommit" + stringid.GenerateRandomID()
 	_, b, err := sockRequest("POST", "/commit?repo="+name+"&testtag=tag&container="+id, nil)
 	if err != nil && !strings.Contains(err.Error(), "200 OK: 201") {
 		c.Fatal(err)
@@ -650,7 +650,7 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
 	// sanity check, make sure the image is what we think it is
 	out, err = exec.Command(dockerBinary, "run", img.Id, "ls", "/test").CombinedOutput()
 	if err != nil {
-		c.Fatal(out, err)
+		c.Fatalf("error checking commited image: %v - %q", err, string(out))
 	}
 }
 

+ 1 - 3
integration-cli/docker_utils.go

@@ -444,8 +444,7 @@ func unpauseAllContainers() error {
 }
 
 func deleteImages(images ...string) error {
-	args := make([]string, 1, 2)
-	args[0] = "rmi"
+	args := []string{"rmi", "-f"}
 	args = append(args, images...)
 	rmiCmd := exec.Command(dockerBinary, args...)
 	exitCode, err := runCommand(rmiCmd)
@@ -453,7 +452,6 @@ func deleteImages(images ...string) error {
 	if exitCode != 0 && err == nil {
 		err = fmt.Errorf("failed to remove image: `docker rmi` exit is non-zero")
 	}
-
 	return err
 }