diff --git a/e2e/image/pull_test.go b/e2e/image/pull_test.go index 3855bf3a43..2815672117 100644 --- a/e2e/image/pull_test.go +++ b/e2e/image/pull_test.go @@ -31,10 +31,7 @@ func TestPullWithContentTrust(t *testing.T) { icmd.RunCommand("docker", "rmi", image).Assert(t, icmd.Success) // push an unsigned image on the same reference name, but with different content (busybox) - icmd.RunCommand("docker", "pull", busyboxImage).Assert(t, icmd.Success) - icmd.RunCommand("docker", "tag", busyboxImage, image).Assert(t, icmd.Success) - icmd.RunCommand("docker", "push", image).Assert(t, icmd.Success) - icmd.RunCommand("docker", "rmi", image).Assert(t, icmd.Success) + createNamedUnsignedImageFromBusyBox(t, image) // now pull with content trust result = icmd.RunCmd(trustedCmdNoPassphrases(icmd.Command("docker", "pull", image))) @@ -54,6 +51,13 @@ func createTrustedRemoteImage(t *testing.T, repo, tag string) string { return image } +func createNamedUnsignedImageFromBusyBox(t *testing.T, image string) { + icmd.RunCommand("docker", "pull", busyboxImage).Assert(t, icmd.Success) + icmd.RunCommand("docker", "tag", busyboxImage, image).Assert(t, icmd.Success) + icmd.RunCommand("docker", "push", image).Assert(t, icmd.Success) + icmd.RunCommand("docker", "rmi", image).Assert(t, icmd.Success) +} + func trustedCmdWithPassphrases(cmd icmd.Cmd, rootPwd, repositoryPwd string) icmd.Cmd { env := append(os.Environ(), []string{ "DOCKER_CONTENT_TRUST=1",