1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integcli: test container removal for failed builds

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
unclejack 2014-05-19 19:46:25 +03:00
parent 77f5425260
commit 69dcf767fd
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,3 @@
FROM busybox
RUN true
RUN thiswillfail

View file

@ -207,6 +207,33 @@ func TestBuildWithInaccessibleFilesInContext(t *testing.T) {
logDone("build - ADD from context with accessible links must work")
}
func TestBuildForceRm(t *testing.T) {
containerCountBefore, err := getContainerCount()
if err != nil {
t.Fatalf("failed to get the container count: %s", err)
}
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestBuildForceRm")
buildCmd := exec.Command(dockerBinary, "build", "--force-rm", ".")
buildCmd.Dir = buildDirectory
_, exitCode, err := runCommandWithOutput(buildCmd)
if err == nil || exitCode == 0 {
t.Fatal("failed to build the image")
}
containerCountAfter, err := getContainerCount()
if err != nil {
t.Fatalf("failed to get the container count: %s", err)
}
if containerCountBefore != containerCountAfter {
t.Fatalf("--force-rm shouldn't have left containers behind")
}
logDone("build - ensure --force-rm doesn't leave containers behind")
}
// TODO: TestCaching
// TODO: TestADDCacheInvalidation