Make sure integration-cli test clean up

Common patterns:
- Multiple images were built with same name but only one cleanup.
- Containers were deleted after images.
- Images not removed after retagging.

Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
Upstream-commit: da3d3b97ebe1e6fe1254367521c725ca12a5e61d
Component: engine
This commit is contained in:
Tonis Tiigi
2014-11-17 18:05:49 +02:00
parent de98d16e28
commit 865600707c
7 changed files with 124 additions and 43 deletions

View File

@ -239,12 +239,15 @@ func TestSaveMultipleNames(t *testing.T) {
if out, _, err := runCommandWithOutput(tagCmd); err != nil {
t.Fatalf("failed to tag repo: %s, %v", out, err)
}
defer deleteImages(repoName + "-one")
// Make two images
tagCmdFinal = fmt.Sprintf("%v tag scratch:latest %v-two:latest", dockerBinary, repoName)
tagCmd = exec.Command("bash", "-c", tagCmdFinal)
if out, _, err := runCommandWithOutput(tagCmd); err != nil {
t.Fatalf("failed to tag repo: %s, %v", out, err)
}
defer deleteImages(repoName + "-two")
saveCmdFinal := fmt.Sprintf("%v save %v-one %v-two:latest | tar xO repositories | grep -q -E '(-one|-two)'", dockerBinary, repoName, repoName)
saveCmd := exec.Command("bash", "-c", saveCmdFinal)