func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
	testRequires(c, DaemonIsLinux)
	s.Cmd(c, "pull", "busybox")
	outImageCmd := s.Cmd(c, "images", "busybox")
	splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n")
	c.Assert(splitOutImageCmd, checker.HasLen, 2, check.Commentf("expected a single entry in images\n%v", outImageCmd))

	s.Cmd(c, "pull", "--all-tags=true", "busybox")
	outImageAllTagCmd := s.Cmd(c, "images", "busybox")
	if linesCount := strings.Count(outImageAllTagCmd, "\n"); linesCount <= 2 {
		c.Fatalf("pulling all tags should provide more images, got %d", linesCount-1)
	}

	// Verify that the line for 'busybox:latest' is left unchanged.
	var latestLine string
	for _, line := range strings.Split(outImageAllTagCmd, "\n") {
		if strings.HasPrefix(line, "busybox") && strings.Contains(line, "latest") {
			latestLine = line
			break
		}
	}
	c.Assert(latestLine, checker.Not(checker.Equals), "", check.Commentf("no entry for busybox:latest found after pulling all tags"))
	splitLatest := strings.Fields(latestLine)
	splitCurrent := strings.Fields(splitOutImageCmd[1])
	c.Assert(splitLatest, checker.DeepEquals, splitCurrent, check.Commentf("busybox:latest was changed after pulling all tags"))
}
// TestPullAllTagsFromCentralRegistry pulls using `all-tags` for a given image and verifies that it
// results in more images than a naked pull.
TestPullAllTagsFromCentralRegistry pulls using `all-tags` for a given image and verifies that it
results in more images than a naked pull.
// TestPullAllTagsFromCentralRegistry pulls using ` all - tags ` for a given image and verifies that it // results in more images than a naked pull .
func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
	testRequires(c, DaemonIsLinux)
	s.Cmd(c, "pull", "busybox")
	outImageCmd := s.Cmd(c, "images", "busybox")
	splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n")
	c.Assert(splitOutImageCmd, checker.HasLen, 2, check.Commentf("expected a single entry in images\n%v", outImageCmd))
	s.Cmd(c, "pull", "--all-tags=true", "busybox")
	outImageAllTagCmd := s.Cmd(c, "images", "busybox")
	if linesCount := strings.Count(outImageAllTagCmd, "\n"); linesCount <= 2 {
		c.Fatalf("pulling all tags should provide more images, got %d", linesCount-1)
	}
	var latestLine string
	for _, line := range strings.Split(outImageAllTagCmd, "\n") {
		if strings.HasPrefix(line, "busybox") && strings.Contains(line, "latest") {
			latestLine = line
			break
		}
	}
	c.Assert(latestLine, checker.Not(checker.Equals), "", check.Commentf("no entry for busybox:latest found after pulling all tags"))
	splitLatest := strings.Fields(latestLine)
	splitCurrent := strings.Fields(splitOutImageCmd[1])
	c.Assert(splitLatest, checker.DeepEquals, splitCurrent, check.Commentf("busybox:latest was changed after pulling all tags"))
}
func ( s * DockerHubPullSuite ) TestPullAllTagsFromCentralRegistry ( c * check . C ) { testRequires ( c , DaemonIsLinux ) s . Cmd ( c , " " , " " ) outImageCmd := s . Cmd ( c , " " , " " ) splitOutImageCmd := strings . Split ( strings . TrimSpace ( outImageCmd ) , " \n " ) c . Assert ( splitOutImageCmd , checker . HasLen , 2 , check . Commentf ( " \n " , outImageCmd ) ) s . Cmd ( c , " " , " " , " " ) outImageAllTagCmd := s . Cmd ( c , " " , " " ) if linesCount := strings . Count ( outImageAllTagCmd , " \n " ) ; linesCount <= 2 { c . Fatalf ( " " , linesCount - 1 ) } var latestLine string for _ , line := range strings . Split ( outImageAllTagCmd , " \n " ) { if strings . HasPrefix ( line , " " ) && strings . Contains ( line , " " ) { latestLine = line break } } c . Assert ( latestLine , checker . Not ( checker . Equals ) , " " , check . Commentf ( " " ) ) splitLatest := strings . Fields ( latestLine ) splitCurrent := strings . Fields ( splitOutImageCmd [ 1 ] ) c . Assert ( splitLatest , checker . DeepEquals , splitCurrent , check . Commentf ( " " ) ) }
TestPullAllTagsFromCentralRegistry pulls using `all-tags` for a given image and verifies that it
results in more images than a naked pull.
TestPullAllTagsFromCentralRegistry pulls using ` all - tags ` for a given image and verifies that it results in more images than a naked pull .
// Verify that the line for 'busybox:latest' is left unchanged.