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

Clean integration-cli/utils.go from most of its content

Most of the code is now on pkg/integration.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2016-12-13 21:21:51 +01:00
parent 1dece339c3
commit def13fa23c
No known key found for this signature in database
GPG key ID: 083CC6FD6EB699A3
23 changed files with 210 additions and 269 deletions

View file

@ -9,6 +9,7 @@ import (
"regexp"
"strings"
"github.com/docker/docker/pkg/integration"
"github.com/docker/docker/pkg/integration/checker"
icmd "github.com/docker/docker/pkg/integration/cmd"
"github.com/go-check/check"
@ -19,7 +20,7 @@ func (s *DockerSuite) TestImportDisplay(c *check.C) {
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
cleanedContainerID := strings.TrimSpace(out)
out, _, err := runCommandPipelineWithOutput(
out, _, err := integration.RunCommandPipelineWithOutput(
exec.Command(dockerBinary, "export", cleanedContainerID),
exec.Command(dockerBinary, "import", "-"),
)
@ -51,11 +52,10 @@ func (s *DockerSuite) TestImportFile(c *check.C) {
c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
defer os.Remove(temporaryFile.Name())
runCmd := exec.Command(dockerBinary, "export", "test-import")
runCmd.Stdout = bufio.NewWriter(temporaryFile)
_, err = runCommand(runCmd)
c.Assert(err, checker.IsNil, check.Commentf("failed to export a container"))
icmd.RunCmd(icmd.Cmd{
Command: []string{dockerBinary, "export", "test-import"},
Stdout: bufio.NewWriter(temporaryFile),
}).Assert(c, icmd.Success)
out, _ := dockerCmd(c, "import", temporaryFile.Name())
c.Assert(out, checker.Count, "\n", 1, check.Commentf("display is expected 1 '\\n' but didn't"))
@ -73,14 +73,12 @@ func (s *DockerSuite) TestImportGzipped(c *check.C) {
c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
defer os.Remove(temporaryFile.Name())
runCmd := exec.Command(dockerBinary, "export", "test-import")
w := gzip.NewWriter(temporaryFile)
runCmd.Stdout = w
_, err = runCommand(runCmd)
c.Assert(err, checker.IsNil, check.Commentf("failed to export a container"))
err = w.Close()
c.Assert(err, checker.IsNil, check.Commentf("failed to close gzip writer"))
icmd.RunCmd(icmd.Cmd{
Command: []string{dockerBinary, "export", "test-import"},
Stdout: w,
}).Assert(c, icmd.Success)
c.Assert(w.Close(), checker.IsNil, check.Commentf("failed to close gzip writer"))
temporaryFile.Close()
out, _ := dockerCmd(c, "import", temporaryFile.Name())
c.Assert(out, checker.Count, "\n", 1, check.Commentf("display is expected 1 '\\n' but didn't"))
@ -98,11 +96,10 @@ func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
c.Assert(err, checker.IsNil, check.Commentf("failed to create temporary file"))
defer os.Remove(temporaryFile.Name())
runCmd := exec.Command(dockerBinary, "export", "test-import")
runCmd.Stdout = bufio.NewWriter(temporaryFile)
_, err = runCommand(runCmd)
c.Assert(err, checker.IsNil, check.Commentf("failed to export a container"))
icmd.RunCmd(icmd.Cmd{
Command: []string{dockerBinary, "export", "test-import"},
Stdout: bufio.NewWriter(temporaryFile),
}).Assert(c, icmd.Success)
message := "Testing commit message"
out, _ := dockerCmd(c, "import", "-m", message, temporaryFile.Name())