Remove use of 'bash' from our tests
| ... | ... |
@@ -61,7 +61,8 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
|
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 | 63 |
func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
|
| 64 |
- runCmd := exec.Command("bash", "-c", `echo "blahblah" | docker run -i -a stdin busybox cat`)
|
|
| 64 |
+ runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat") |
|
| 65 |
+ runCmd.Stdin = strings.NewReader("blahblah")
|
|
| 65 | 66 |
out, _, _, err := runCommandWithStdoutStderr(runCmd) |
| 66 | 67 |
if err != nil {
|
| 67 | 68 |
c.Fatalf("failed to run container: %v, output: %q", err, out)
|
| ... | ... |
@@ -176,7 +176,8 @@ func (s *DockerSuite) TestRunExitCodeOne(c *check.C) {
|
| 176 | 176 |
// it should be possible to pipe in data via stdin to a process running in a container |
| 177 | 177 |
// some versions of lxc might make this test fail |
| 178 | 178 |
func (s *DockerSuite) TestRunStdinPipe(c *check.C) {
|
| 179 |
- runCmd := exec.Command("bash", "-c", `echo "blahblah" | docker run -i -a stdin busybox cat`)
|
|
| 179 |
+ runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat") |
|
| 180 |
+ runCmd.Stdin = strings.NewReader("blahblah")
|
|
| 180 | 181 |
out, _, _, err := runCommandWithStdoutStderr(runCmd) |
| 181 | 182 |
if err != nil {
|
| 182 | 183 |
c.Fatalf("failed to run container: %v, output: %q", err, out)
|
| ... | ... |
@@ -4,7 +4,7 @@ package main |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 | 6 |
"bytes" |
| 7 |
- "fmt" |
|
| 7 |
+ "io/ioutil" |
|
| 8 | 8 |
"os" |
| 9 | 9 |
"os/exec" |
| 10 | 10 |
|
| ... | ... |
@@ -34,17 +34,25 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
|
| 34 | 34 |
c.Fatalf("the repo should exist before saving it: %s, %v", before, err)
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
- saveCmdTemplate := `%v save %v > /tmp/foobar-save-load-test.tar` |
|
| 38 |
- saveCmdFinal := fmt.Sprintf(saveCmdTemplate, dockerBinary, repoName) |
|
| 39 |
- saveCmd := exec.Command("bash", "-c", saveCmdFinal)
|
|
| 40 |
- if out, _, err = runCommandWithOutput(saveCmd); err != nil {
|
|
| 41 |
- c.Fatalf("failed to save repo: %s, %v", out, err)
|
|
| 37 |
+ tmpFile, err := ioutil.TempFile("", "foobar-save-load-test.tar")
|
|
| 38 |
+ c.Assert(err, check.IsNil) |
|
| 39 |
+ defer os.Remove(tmpFile.Name()) |
|
| 40 |
+ |
|
| 41 |
+ saveCmd := exec.Command(dockerBinary, "save", repoName) |
|
| 42 |
+ saveCmd.Stdout = tmpFile |
|
| 43 |
+ |
|
| 44 |
+ if _, err = runCommand(saveCmd); err != nil {
|
|
| 45 |
+ c.Fatalf("failed to save repo: %v", err)
|
|
| 42 | 46 |
} |
| 43 | 47 |
|
| 48 |
+ tmpFile, err = os.Open(tmpFile.Name()) |
|
| 49 |
+ c.Assert(err, check.IsNil) |
|
| 50 |
+ |
|
| 44 | 51 |
deleteImages(repoName) |
| 45 | 52 |
|
| 46 |
- loadCmdFinal := `cat /tmp/foobar-save-load-test.tar | docker load` |
|
| 47 |
- loadCmd := exec.Command("bash", "-c", loadCmdFinal)
|
|
| 53 |
+ loadCmd := exec.Command(dockerBinary, "load") |
|
| 54 |
+ loadCmd.Stdin = tmpFile |
|
| 55 |
+ |
|
| 48 | 56 |
if out, _, err = runCommandWithOutput(loadCmd); err != nil {
|
| 49 | 57 |
c.Fatalf("failed to load repo: %s, %v", out, err)
|
| 50 | 58 |
} |
| ... | ... |
@@ -61,8 +69,6 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
|
| 61 | 61 |
|
| 62 | 62 |
deleteImages(repoName) |
| 63 | 63 |
|
| 64 |
- os.Remove("/tmp/foobar-save-load-test.tar")
|
|
| 65 |
- |
|
| 66 | 64 |
pty, tty, err := pty.Open() |
| 67 | 65 |
if err != nil {
|
| 68 | 66 |
c.Fatalf("Could not open pty: %v", err)
|