1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Remove use of 'bash' from our tests

Not 100% sure why our Windows test don't complain about some of these,
I'm guessing it because we have bash as part of some git package, but
either way we really shouldn't require bash to run our tests unless we
really need to - which in these cases we don't

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2015-05-16 11:04:25 -07:00
parent b5e932a3bf
commit 3b1f73fbcd
3 changed files with 20 additions and 12 deletions

View file

@ -69,7 +69,8 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
} }
func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) { func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
runCmd := exec.Command("bash", "-c", `echo "blahblah" | docker run -i -a stdin busybox cat`) runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
runCmd.Stdin = strings.NewReader("blahblah")
out, _, _, err := runCommandWithStdoutStderr(runCmd) out, _, _, err := runCommandWithStdoutStderr(runCmd)
if err != nil { if err != nil {
c.Fatalf("failed to run container: %v, output: %q", err, out) c.Fatalf("failed to run container: %v, output: %q", err, out)

View file

@ -179,7 +179,8 @@ func (s *DockerSuite) TestRunExitCodeOne(c *check.C) {
// it should be possible to pipe in data via stdin to a process running in a container // it should be possible to pipe in data via stdin to a process running in a container
// some versions of lxc might make this test fail // some versions of lxc might make this test fail
func (s *DockerSuite) TestRunStdinPipe(c *check.C) { func (s *DockerSuite) TestRunStdinPipe(c *check.C) {
runCmd := exec.Command("bash", "-c", `echo "blahblah" | docker run -i -a stdin busybox cat`) runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
runCmd.Stdin = strings.NewReader("blahblah")
out, _, _, err := runCommandWithStdoutStderr(runCmd) out, _, _, err := runCommandWithStdoutStderr(runCmd)
if err != nil { if err != nil {
c.Fatalf("failed to run container: %v, output: %q", err, out) c.Fatalf("failed to run container: %v, output: %q", err, out)

View file

@ -4,7 +4,7 @@ package main
import ( import (
"bytes" "bytes"
"fmt" "io/ioutil"
"os" "os"
"os/exec" "os/exec"
"strings" "strings"
@ -41,17 +41,25 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
c.Fatalf("the repo should exist before saving it: %s, %v", before, err) c.Fatalf("the repo should exist before saving it: %s, %v", before, err)
} }
saveCmdTemplate := `%v save %v > /tmp/foobar-save-load-test.tar` tmpFile, err := ioutil.TempFile("", "foobar-save-load-test.tar")
saveCmdFinal := fmt.Sprintf(saveCmdTemplate, dockerBinary, repoName) c.Assert(err, check.IsNil)
saveCmd := exec.Command("bash", "-c", saveCmdFinal) defer os.Remove(tmpFile.Name())
if out, _, err = runCommandWithOutput(saveCmd); err != nil {
c.Fatalf("failed to save repo: %s, %v", out, err) saveCmd := exec.Command(dockerBinary, "save", repoName)
saveCmd.Stdout = tmpFile
if _, err = runCommand(saveCmd); err != nil {
c.Fatalf("failed to save repo: %v", err)
} }
tmpFile, err = os.Open(tmpFile.Name())
c.Assert(err, check.IsNil)
deleteImages(repoName) deleteImages(repoName)
loadCmdFinal := `cat /tmp/foobar-save-load-test.tar | docker load` loadCmd := exec.Command(dockerBinary, "load")
loadCmd := exec.Command("bash", "-c", loadCmdFinal) loadCmd.Stdin = tmpFile
if out, _, err = runCommandWithOutput(loadCmd); err != nil { if out, _, err = runCommandWithOutput(loadCmd); err != nil {
c.Fatalf("failed to load repo: %s, %v", out, err) c.Fatalf("failed to load repo: %s, %v", out, err)
} }
@ -69,8 +77,6 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
deleteContainer(cleanedContainerID) deleteContainer(cleanedContainerID)
deleteImages(repoName) deleteImages(repoName)
os.Remove("/tmp/foobar-save-load-test.tar")
pty, tty, err := pty.Open() pty, tty, err := pty.Open()
if err != nil { if err != nil {
c.Fatalf("Could not open pty: %v", err) c.Fatalf("Could not open pty: %v", err)