mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 04:31:28 +00:00
Update image pull tests
Update and migrate existing tests to the `DockerHubPullSuite`. Most tests were preserved, but refactored and made more exhaustive. One test was deliberately removed (`TestPullVerified`) as it is unreliable and that the feature was obsoleted by content trust. Move all trust related tests to `docker_cli_pull_trusted_test.go`. Move tests depending on a local registry to `docker_cli_pull_local_test.go`. Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-check/check"
|
||||
)
|
||||
|
||||
// TestPullImageWithAliases pulls a specific image tag and verifies that any aliases (i.e., other
|
||||
// tags for the same image) are not also pulled down.
|
||||
//
|
||||
// Ref: docker/docker#8141
|
||||
func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
|
||||
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
||||
|
||||
repos := []string{}
|
||||
for _, tag := range []string{"recent", "fresh"} {
|
||||
repos = append(repos, fmt.Sprintf("%v:%v", repoName, tag))
|
||||
}
|
||||
|
||||
// Tag and push the same image multiple times.
|
||||
for _, repo := range repos {
|
||||
dockerCmd(c, "tag", "busybox", repo)
|
||||
dockerCmd(c, "push", repo)
|
||||
}
|
||||
|
||||
// Clear local images store.
|
||||
args := append([]string{"rmi"}, repos...)
|
||||
dockerCmd(c, args...)
|
||||
|
||||
// Pull a single tag and verify it doesn't bring down all aliases.
|
||||
dockerCmd(c, "pull", repos[0])
|
||||
dockerCmd(c, "inspect", repos[0])
|
||||
for _, repo := range repos[1:] {
|
||||
if _, _, err := dockerCmdWithError("inspect", repo); err == nil {
|
||||
c.Fatalf("Image %v shouldn't have been pulled down", repo)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user