github.com/adxhyt/docker@v1.4.2-0.20150117221845-467b7c821390/integration-cli/docker_cli_import_test.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os/exec" 6 "strings" 7 "testing" 8 ) 9 10 func TestImportDisplay(t *testing.T) { 11 server, err := fileServer(map[string]string{ 12 "/cirros.tar.gz": "/cirros.tar.gz", 13 }) 14 if err != nil { 15 t.Fatal(err) 16 } 17 defer server.Close() 18 fileURL := fmt.Sprintf("%s/cirros.tar.gz", server.URL) 19 importCmd := exec.Command(dockerBinary, "import", fileURL, "cirros") 20 out, _, err := runCommandWithOutput(importCmd) 21 if err != nil { 22 t.Errorf("import failed with errors: %v, output: %q", err, out) 23 } 24 25 if n := strings.Count(out, "\n"); n != 2 { 26 t.Fatalf("display is messed up: %d '\\n' instead of 2", n) 27 } 28 29 deleteImages("cirros") 30 31 logDone("import - cirros was imported and display is fine") 32 }