1
0
mirror of https://github.com/moby/moby.git synced 2025-11-09 13:41:11 +03:00

Fix docker load progressbar, fixes #21957

Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
Lei Jitang
2016-04-12 22:45:42 -04:00
parent 577adcc1ee
commit 96d7db665b
4 changed files with 33 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
@@ -65,3 +66,22 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
c.Assert(err, check.IsNil) //could not read tty output
c.Assert(string(buf[:n]), checker.Contains, "Cowardly refusing", check.Commentf("help output is not being yielded", out))
}
func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *check.C) {
name := "test-load"
_, err := buildImage(name, `
FROM busybox
RUN touch aa
`, true)
c.Assert(err, check.IsNil)
tmptar := name + ".tar"
dockerCmd(c, "save", "-o", tmptar, name)
defer os.Remove(tmptar)
dockerCmd(c, "rmi", name)
dockerCmd(c, "tag", "busybox", name)
out, _ := dockerCmd(c, "load", "-i", tmptar)
expected := fmt.Sprintf("The image %s:latest already exists, renaming the old one with ID", name)
c.Assert(out, checker.Contains, expected)
}