Better test cleanup with defer

This fixes a few misuses of `deleteAllContainers()` cleanup
method in integration-cli suite by moving call to the
beginning of the method and guaranteeing their execution
(including panics) with `defer`s.

Also added some forgotten cleanup calls while I'm at it.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
Ahmet Alp Balkan
2015-02-20 14:04:36 -08:00
parent a78ce5c228
commit 70407ce40c
16 changed files with 290 additions and 251 deletions
+2 -2
View File
@@ -7,6 +7,8 @@ import (
)
func TestInspectApiContainerResponse(t *testing.T) {
defer deleteAllContainers()
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true")
out, _, err := runCommandWithOutput(runCmd)
if err != nil {
@@ -53,7 +55,5 @@ func TestInspectApiContainerResponse(t *testing.T) {
}
}
deleteAllContainers()
logDone("container json - check keys in container json response")
}