Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 6ac6d28

Browse files
committed
Update TestLoadFromLocalTarDelta
1 parent f4e408f commit 6ac6d28

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

integration-cli/docker_utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,11 @@ func ensureImageExist(c *check.C, imageName string) {
19341934
}
19351935
}
19361936

1937+
func ensureImageIDExist(c *check.C, imageName, imageID string) {
1938+
realImgID := inspectField(c, imageName, "Id")
1939+
c.Assert(realImgID, checker.Equals, imageID)
1940+
}
1941+
19371942
//get containerId or imageId from hyper command output
19381943
func getIDfromOutput(c *check.C, output string) string {
19391944
outAry := strings.Split(output, "\n")

integration-cli/hyper_cli_load_local_test.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ func (s *DockerSuite) TestLoadFromLocalTarDelta(c *check.C) {
7474
defer printTestDuration(time.Now())
7575
testRequires(c, DaemonIsLinux)
7676

77-
baseURL := "http://image-tarball.s3.amazonaws.com/test/public/debian_stretch-slim.tar.gz"
78-
basePath := fmt.Sprintf("%s/debian_stretch-slim.tar.gz", os.Getenv("IMAGE_DIR"))
77+
baseURL := "http://image-tarball.s3.amazonaws.com/test/public/busybox.gz"
78+
basePath := fmt.Sprintf("%s/busybox.gz", os.Getenv("IMAGE_DIR"))
7979

80-
publicURL := "http://image-tarball.s3.amazonaws.com/test/public/nginx_stable.tar.gz"
81-
imagePath := fmt.Sprintf("%s/nginx_stable.tar.gz", os.Getenv("IMAGE_DIR"))
80+
deltaURL := "https://image-tarball.s3.amazonaws.com/test/public/busybox2.gz"
81+
deltaPath := fmt.Sprintf("%s/buxybox2.gz", os.Getenv("IMAGE_DIR"))
8282

8383
//download base image tar
8484
wgetCmd := exec.Command("wget", "-cO", basePath, baseURL)
@@ -87,30 +87,26 @@ func (s *DockerSuite) TestLoadFromLocalTarDelta(c *check.C) {
8787
c.Assert(err, checker.IsNil)
8888
c.Assert(pathExist(basePath), checker.Equals, true)
8989

90-
wgetCmd = exec.Command("wget", "-cO", imagePath, publicURL)
90+
wgetCmd = exec.Command("wget", "-cO", deltaPath, deltaURL)
9191
output, exitCode, err = runCommandWithOutput(wgetCmd)
9292
c.Assert(exitCode, checker.Equals, 0)
9393
c.Assert(err, checker.IsNil)
94-
c.Assert(pathExist(imagePath), checker.Equals, true)
94+
c.Assert(pathExist(deltaPath), checker.Equals, true)
9595

9696
//load image tar
9797
output, exitCode, err = dockerCmdWithError("load", "-i", basePath)
9898
c.Assert(output, checker.Contains, "has been loaded.")
9999
c.Assert(err, checker.IsNil)
100100
c.Assert(exitCode, checker.Equals, 0)
101101

102-
output, exitCode, err = dockerCmdWithError("load", "-i", imagePath)
102+
output, exitCode, err = dockerCmdWithError("load", "-i", deltaPath)
103103
c.Assert(output, checker.Contains, "has been loaded.")
104104
c.Assert(err, checker.IsNil)
105105
c.Assert(exitCode, checker.Equals, 0)
106106

107-
//check image
108-
images, _ := dockerCmd(c, "images", "debian:stretch-slim")
109-
c.Assert(images, checker.Contains, "debian")
110-
111-
//check image
112-
images, _ = dockerCmd(c, "images", "nginx:stable")
113-
c.Assert(images, checker.Contains, "nginx")
107+
// //check image
108+
ensureImageIDExist(c, "busybox", "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113798")
109+
ensureImageIDExist(c, "busybox2", "sha256:50a48a50d85a126c96d01528bb836e62ad08555e740b44f299abf3416656bdb5")
114110
}
115111

116112
func (s *DockerSuite) TestLoadFromLocalCompressedArchive(c *check.C) {

0 commit comments

Comments
 (0)