Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
| ... | ... |
@@ -1,7 +1,6 @@ |
| 1 | 1 |
package main |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "fmt" |
|
| 5 | 4 |
"os" |
| 6 | 5 |
"os/exec" |
| 7 | 6 |
"strings" |
| ... | ... |
@@ -66,15 +65,18 @@ func TestExportContainerWithOutputAndImportImage(t *testing.T) {
|
| 66 | 66 |
t.Fatalf("output should've been a container id: %s %s ", cleanedContainerID, err)
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
- exportCmdTemplate := `%v export --output=/tmp/testexp.tar %v` |
|
| 70 |
- exportCmdFinal := fmt.Sprintf(exportCmdTemplate, dockerBinary, cleanedContainerID) |
|
| 71 |
- exportCmd := exec.Command(exportCmdFinal) |
|
| 69 |
+ exportCmd := exec.Command(dockerBinary, "export", "--output=testexp.tar", cleanedContainerID) |
|
| 72 | 70 |
if out, _, err = runCommandWithOutput(exportCmd); err != nil {
|
| 73 | 71 |
t.Fatalf("failed to export container: %s, %v", out, err)
|
| 74 | 72 |
} |
| 75 | 73 |
|
| 76 |
- importCmdFinal := `cat /tmp/testexp.tar | docker import - repo/testexp:v1` |
|
| 77 |
- importCmd := exec.Command(importCmdFinal) |
|
| 74 |
+ out, _, err = runCommandWithOutput(exec.Command("cat", "testexp.tar"))
|
|
| 75 |
+ if err != nil {
|
|
| 76 |
+ t.Fatal(out, err) |
|
| 77 |
+ } |
|
| 78 |
+ |
|
| 79 |
+ importCmd := exec.Command(dockerBinary, "import", "-", "repo/testexp:v1") |
|
| 80 |
+ importCmd.Stdin = strings.NewReader(out) |
|
| 78 | 81 |
out, _, err = runCommandWithOutput(importCmd) |
| 79 | 82 |
if err != nil {
|
| 80 | 83 |
t.Fatalf("failed to import image: %s, %v", out, err)
|