Merge pull request #12692 from cpuguy83/fix_commit_test

Fix race with TestContainerApiCommit
This commit is contained in:
Jessie Frazelle 2015-04-23 11:31:27 -07:00
commit 59acccb6f2
2 changed files with 3 additions and 5 deletions

View file

@ -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))
}
}

View file

@ -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
}