fix TestExportContainerWithOutputAndImportImage on windows
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
parent
5ff122f797
commit
6a313e81cc
1 changed files with 8 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -66,15 +65,18 @@ func TestExportContainerWithOutputAndImportImage(t *testing.T) {
|
||||||
t.Fatalf("output should've been a container id: %s %s ", cleanedContainerID, err)
|
t.Fatalf("output should've been a container id: %s %s ", cleanedContainerID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
exportCmdTemplate := `%v export --output=/tmp/testexp.tar %v`
|
exportCmd := exec.Command(dockerBinary, "export", "--output=testexp.tar", cleanedContainerID)
|
||||||
exportCmdFinal := fmt.Sprintf(exportCmdTemplate, dockerBinary, cleanedContainerID)
|
|
||||||
exportCmd := exec.Command(exportCmdFinal)
|
|
||||||
if out, _, err = runCommandWithOutput(exportCmd); err != nil {
|
if out, _, err = runCommandWithOutput(exportCmd); err != nil {
|
||||||
t.Fatalf("failed to export container: %s, %v", out, err)
|
t.Fatalf("failed to export container: %s, %v", out, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
importCmdFinal := `cat /tmp/testexp.tar | docker import - repo/testexp:v1`
|
out, _, err = runCommandWithOutput(exec.Command("cat", "testexp.tar"))
|
||||||
importCmd := exec.Command(importCmdFinal)
|
if err != nil {
|
||||||
|
t.Fatal(out, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
importCmd := exec.Command(dockerBinary, "import", "-", "repo/testexp:v1")
|
||||||
|
importCmd.Stdin = strings.NewReader(out)
|
||||||
out, _, err = runCommandWithOutput(importCmd)
|
out, _, err = runCommandWithOutput(importCmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to import image: %s, %v", out, err)
|
t.Fatalf("failed to import image: %s, %v", out, err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue