Merge pull request #23377 from vdemeester/carry-pr-23007

Carry #23007 :  Say something useful during docker load
Upstream-commit: 9db33b7646854ed994b74d0e71bced087e617291
Component: engine
This commit is contained in:
Brian Goff
2016-06-08 13:42:22 -04:00
4 changed files with 59 additions and 4 deletions
@@ -350,3 +350,33 @@ func (s *DockerSuite) TestSaveLoadParents(c *check.C) {
inspectOut = inspectField(c, idFoo, "Parent")
c.Assert(inspectOut, checker.Equals, "")
}
func (s *DockerSuite) TestSaveLoadNoTag(c *check.C) {
testRequires(c, DaemonIsLinux)
name := "saveloadnotag"
_, err := buildImage(name, "FROM busybox\nENV foo=bar", true)
c.Assert(err, checker.IsNil, check.Commentf("%v", err))
id := inspectField(c, name, "Id")
// Test to make sure that save w/o name just shows imageID during load
out, _, err := runCommandPipelineWithOutput(
exec.Command(dockerBinary, "save", id),
exec.Command(dockerBinary, "load"))
c.Assert(err, checker.IsNil, check.Commentf("failed to save and load repo: %s, %v", out, err))
// Should not show 'name' but should show the image ID during the load
c.Assert(out, checker.Not(checker.Contains), "Loaded image: ")
c.Assert(out, checker.Contains, "Loaded image ID:")
c.Assert(out, checker.Contains, id)
// Test to make sure that save by name shows that name during load
out, _, err = runCommandPipelineWithOutput(
exec.Command(dockerBinary, "save", name),
exec.Command(dockerBinary, "load"))
c.Assert(err, checker.IsNil, check.Commentf("failed to save and load repo: %s, %v", out, err))
c.Assert(out, checker.Contains, "Loaded image: "+name+":latest")
c.Assert(out, checker.Not(checker.Contains), "Loaded image ID:")
}