mirror of https://github.com/docker/docs.git
Using checkers assert for integration-cli/docker_cli_export_import_test.go
Signed-off-by: Mohammed Aaqib Ansari <maaquib@gmail.com>
This commit is contained in:
parent
c516aa645e
commit
e72f92cb99
|
@ -5,6 +5,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/docker/pkg/integration/checker"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -20,14 +21,10 @@ func (s *DockerSuite) TestExportContainerAndImportImage(c *check.C) {
|
||||||
importCmd := exec.Command(dockerBinary, "import", "-", "repo/testexp:v1")
|
importCmd := exec.Command(dockerBinary, "import", "-", "repo/testexp:v1")
|
||||||
importCmd.Stdin = strings.NewReader(out)
|
importCmd.Stdin = strings.NewReader(out)
|
||||||
out, _, err := runCommandWithOutput(importCmd)
|
out, _, err := runCommandWithOutput(importCmd)
|
||||||
if err != nil {
|
c.Assert(err, checker.IsNil, check.Commentf("failed to import image repo/testexp:v1: %s", out))
|
||||||
c.Fatalf("failed to import image: %s, %v", out, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanedImageID := strings.TrimSpace(out)
|
cleanedImageID := strings.TrimSpace(out)
|
||||||
if cleanedImageID == "" {
|
c.Assert(cleanedImageID, checker.Not(checker.Equals), "", check.Commentf("output should have been an image id"))
|
||||||
c.Fatalf("output should have been an image id, got: %s", out)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to test output flag in the export command
|
// Used to test output flag in the export command
|
||||||
|
@ -40,19 +37,13 @@ func (s *DockerSuite) TestExportContainerWithOutputAndImportImage(c *check.C) {
|
||||||
defer os.Remove("testexp.tar")
|
defer os.Remove("testexp.tar")
|
||||||
|
|
||||||
out, _, err := runCommandWithOutput(exec.Command("cat", "testexp.tar"))
|
out, _, err := runCommandWithOutput(exec.Command("cat", "testexp.tar"))
|
||||||
if err != nil {
|
c.Assert(err, checker.IsNil, check.Commentf(out))
|
||||||
c.Fatal(out, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
importCmd := exec.Command(dockerBinary, "import", "-", "repo/testexp:v1")
|
importCmd := exec.Command(dockerBinary, "import", "-", "repo/testexp:v1")
|
||||||
importCmd.Stdin = strings.NewReader(out)
|
importCmd.Stdin = strings.NewReader(out)
|
||||||
out, _, err = runCommandWithOutput(importCmd)
|
out, _, err = runCommandWithOutput(importCmd)
|
||||||
if err != nil {
|
c.Assert(err, checker.IsNil, check.Commentf("failed to import image repo/testexp:v1: %s", out))
|
||||||
c.Fatalf("failed to import image: %s, %v", out, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanedImageID := strings.TrimSpace(out)
|
cleanedImageID := strings.TrimSpace(out)
|
||||||
if cleanedImageID == "" {
|
c.Assert(cleanedImageID, checker.Not(checker.Equals), "", check.Commentf("output should have been an image id"))
|
||||||
c.Fatalf("output should have been an image id, got: %s", out)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue