mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
![Arnaud Porterie](/assets/img/avatar_default.png)
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>
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
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)
|
|
}
|
|
}
|
|
}
|