From 7dda6fc3c96badad2f363ae04aecefca1c3dd25d Mon Sep 17 00:00:00 2001 From: Riyaz Faizullabhoy Date: Tue, 10 Oct 2017 12:00:52 -0700 Subject: [PATCH] factor out rigging for pushing unsigned busybox image Signed-off-by: Riyaz Faizullabhoy --- e2e/image/pull_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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",