2014-03-31 19:31:21 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2014-09-12 17:10:42 +00:00
|
|
|
"fmt"
|
2014-03-31 19:31:21 +00:00
|
|
|
"os/exec"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestImportDisplay(t *testing.T) {
|
2014-09-12 17:10:42 +00:00
|
|
|
server, err := fileServer(map[string]string{
|
|
|
|
"/cirros.tar.gz": "/cirros.tar.gz",
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
defer server.Close()
|
2014-10-06 14:26:55 +00:00
|
|
|
fileURL := fmt.Sprintf("%s/cirros.tar.gz", server.URL)
|
2014-11-17 16:05:49 +00:00
|
|
|
importCmd := exec.Command(dockerBinary, "import", fileURL, "cirros")
|
2014-03-31 19:31:21 +00:00
|
|
|
out, _, err := runCommandWithOutput(importCmd)
|
2014-09-12 13:51:21 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("import failed with errors: %v, output: %q", err, out)
|
|
|
|
}
|
2014-03-31 19:31:21 +00:00
|
|
|
|
2014-07-25 22:29:47 +00:00
|
|
|
if n := strings.Count(out, "\n"); n != 2 {
|
|
|
|
t.Fatalf("display is messed up: %d '\\n' instead of 2", n)
|
2014-03-31 19:31:21 +00:00
|
|
|
}
|
|
|
|
|
2014-11-17 16:05:49 +00:00
|
|
|
deleteImages("cirros")
|
|
|
|
|
2014-03-31 19:31:21 +00:00
|
|
|
logDone("import - cirros was imported and display is fine")
|
|
|
|
}
|