mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
da3d3b97eb
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)
32 lines
708 B
Go
32 lines
708 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestImportDisplay(t *testing.T) {
|
|
server, err := fileServer(map[string]string{
|
|
"/cirros.tar.gz": "/cirros.tar.gz",
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer server.Close()
|
|
fileURL := fmt.Sprintf("%s/cirros.tar.gz", server.URL)
|
|
importCmd := exec.Command(dockerBinary, "import", fileURL, "cirros")
|
|
out, _, err := runCommandWithOutput(importCmd)
|
|
if err != nil {
|
|
t.Errorf("import failed with errors: %v, output: %q", err, out)
|
|
}
|
|
|
|
if n := strings.Count(out, "\n"); n != 2 {
|
|
t.Fatalf("display is messed up: %d '\\n' instead of 2", n)
|
|
}
|
|
|
|
deleteImages("cirros")
|
|
|
|
logDone("import - cirros was imported and display is fine")
|
|
}
|