Browse Source

fix TestExportContainerWithOutputAndImportImage on windows

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Jessica Frazelle 10 years ago
parent
commit
6a313e81cc
1 changed files with 8 additions and 6 deletions
  1. 8 6
      integration-cli/docker_cli_export_import_test.go

+ 8 - 6
integration-cli/docker_cli_export_import_test.go

@@ -1,7 +1,6 @@
 package main
 
 import (
-	"fmt"
 	"os"
 	"os/exec"
 	"strings"
@@ -66,15 +65,18 @@ func TestExportContainerWithOutputAndImportImage(t *testing.T) {
 		t.Fatalf("output should've been a container id: %s %s ", cleanedContainerID, err)
 	}
 
-	exportCmdTemplate := `%v export --output=/tmp/testexp.tar %v`
-	exportCmdFinal := fmt.Sprintf(exportCmdTemplate, dockerBinary, cleanedContainerID)
-	exportCmd := exec.Command(exportCmdFinal)
+	exportCmd := exec.Command(dockerBinary, "export", "--output=testexp.tar", cleanedContainerID)
 	if out, _, err = runCommandWithOutput(exportCmd); err != nil {
 		t.Fatalf("failed to export container: %s, %v", out, err)
 	}
 
-	importCmdFinal := `cat /tmp/testexp.tar | docker import - repo/testexp:v1`
-	importCmd := exec.Command(importCmdFinal)
+	out, _, err = runCommandWithOutput(exec.Command("cat", "testexp.tar"))
+	if err != nil {
+		t.Fatal(out, err)
+	}
+
+	importCmd := exec.Command(dockerBinary, "import", "-", "repo/testexp:v1")
+	importCmd.Stdin = strings.NewReader(out)
 	out, _, err = runCommandWithOutput(importCmd)
 	if err != nil {
 		t.Fatalf("failed to import image: %s, %v", out, err)