Browse code

Move implicit pull test to use local registry

Using hub only works for amd64 platforms.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Tonis Tiigi authored on 2016/05/03 07:23:22
Showing 2 changed files
... ...
@@ -421,3 +421,26 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *check.C) {
421 421
 
422 422
 	dockerCmd(c, "--config", tmp, "pull", repoName)
423 423
 }
424
+
425
+// TestRunImplicitPullWithNoTag should pull implicitely only the default tag (latest)
426
+func (s *DockerRegistrySuite) TestRunImplicitPullWithNoTag(c *check.C) {
427
+	testRequires(c, DaemonIsLinux)
428
+	repo := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
429
+	repoTag1 := fmt.Sprintf("%v:latest", repo)
430
+	repoTag2 := fmt.Sprintf("%v:t1", repo)
431
+	// tag the image and upload it to the private registry
432
+	dockerCmd(c, "tag", "busybox", repoTag1)
433
+	dockerCmd(c, "tag", "busybox", repoTag2)
434
+	dockerCmd(c, "push", repo)
435
+	dockerCmd(c, "rmi", repoTag1)
436
+	dockerCmd(c, "rmi", repoTag2)
437
+
438
+	out, _, err := dockerCmdWithError("run", repo)
439
+	c.Assert(err, check.IsNil)
440
+	c.Assert(out, checker.Contains, fmt.Sprintf("Unable to find image '%s:latest' locally", repo))
441
+
442
+	// There should be only one line for repo, the one with repo:latest
443
+	outImageCmd, _, err := dockerCmdWithError("images", repo)
444
+	splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n")
445
+	c.Assert(splitOutImageCmd, checker.HasLen, 2)
446
+}
... ...
@@ -237,20 +237,6 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
237 237
 	c.Assert(splitLatest, checker.DeepEquals, splitCurrent, check.Commentf("busybox:latest was changed after pulling all tags"))
238 238
 }
239 239
 
240
-// TestRunImplicitPullWithNoTagOnlyPullDefaultTag should pull implicitely only the default tag (latest)
241
-func (s *DockerHubPullSuite) TestRunImplicitPullWithNoTagOnlyPullDefaultTag(c *check.C) {
242
-	// run with an image we don't have
243
-	testRequires(c, DaemonIsLinux)
244
-	out := s.Cmd(c, "run", "busybox")
245
-
246
-	c.Assert(out, checker.Contains, "Unable to find image 'busybox:latest' locally")
247
-
248
-	// There should be only one line for busybox, the one with busybox:latest
249
-	outImageCmd := s.Cmd(c, "images", "busybox")
250
-	splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n")
251
-	c.Assert(splitOutImageCmd, checker.HasLen, 2)
252
-}
253
-
254 240
 // TestPullClientDisconnect kills the client during a pull operation and verifies that the operation
255 241
 // gets cancelled.
256 242
 //