From 6eaa9ca2645b00672bea966175c29ca4c2ee5a02 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 5 May 2022 10:04:52 +0200 Subject: e2e: manifest_test: use cached registry Used the cached registry archive instead of pulling down the image from Quay. Signed-off-by: Valentin Rothberg --- test/e2e/manifest_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index 92b8bc2e1..88ccdc87d 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -273,7 +273,10 @@ var _ = Describe("Podman manifest", func() { }) It("authenticated push", func() { - registry, err := podmanRegistry.Start() + registryOptions := &podmanRegistry.Options{ + Image: "docker-archive:" + imageTarPath(registry), + } + registry, err := podmanRegistry.StartWithOptions(registryOptions) Expect(err).To(BeNil()) session := podmanTest.Podman([]string{"manifest", "create", "foo"}) -- cgit v1.2.3-54-g00ecf From 2fa906ccae477decfd0f124cdc10c0367d3856d6 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 5 May 2022 10:14:36 +0200 Subject: e2e: pull_test: remove redundant tests Once upon a time, the tests actually pulled from Docker Hub. This has changed with the rate limits, so we can safely remove the redundant tests to speed up CI. Signed-off-by: Valentin Rothberg --- test/e2e/pull_test.go | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 41eb8b449..80fb5c2ba 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -53,13 +53,13 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(Exit(0)) }) - It("podman pull from docker a not existing image", func() { - session := podmanTest.Podman([]string{"pull", "ibetthisdoesntexistthere:foo"}) + It("podman pull bogus image", func() { + session := podmanTest.Podman([]string{"pull", "quay.io/ibetthis/doesntexistthere:foo"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) }) - It("podman pull from docker with tag", func() { + It("podman pull with tag", func() { session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2:20200210"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) @@ -69,7 +69,7 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(Exit(0)) }) - It("podman pull from docker without tag", func() { + It("podman pull without tag", func() { session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) @@ -79,26 +79,6 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(Exit(0)) }) - It("podman pull from alternate registry with tag", func() { - session := podmanTest.Podman([]string{"pull", cirros}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) - - session = podmanTest.Podman([]string{"rmi", cirros}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) - }) - - It("podman pull from alternate registry without tag", func() { - session := podmanTest.Podman([]string{"pull", "quay.io/libpod/cirros"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) - - session = podmanTest.Podman([]string{"rmi", "quay.io/libpod/cirros"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) - }) - It("podman pull by digest", func() { session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) session.WaitWithDefaultTimeout() @@ -251,12 +231,6 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(Exit(0)) }) - It("podman pull bogus image", func() { - session := podmanTest.Podman([]string{"pull", "umohnani/get-started"}) - session.WaitWithDefaultTimeout() - Expect(session).To(ExitWithError()) - }) - It("podman pull from docker-archive", func() { SkipIfRemote("podman-remote does not support pulling from docker-archive") -- cgit v1.2.3-54-g00ecf From 669401c31468bf61e13a909655036d5acddbcb31 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 5 May 2022 10:38:42 +0200 Subject: e2e: pull_test: move tests around Let's keep simple tests at the top and complex ones at the bottom. Signed-off-by: Valentin Rothberg --- test/e2e/pull_test.go | 72 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 80fb5c2ba..0eff9a550 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -94,6 +94,42 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(Exit(0)) }) + It("podman pull check quiet", func() { + err := podmanTest.RestoreArtifact(ALPINE) + Expect(err).ToNot(HaveOccurred()) + setup := podmanTest.Podman([]string{"images", ALPINE, "-q", "--no-trunc"}) + setup.WaitWithDefaultTimeout() + Expect(setup).Should(Exit(0)) + shortImageID := strings.Split(setup.OutputToString(), ":")[1] + + rmi := podmanTest.Podman([]string{"rmi", ALPINE}) + rmi.WaitWithDefaultTimeout() + Expect(rmi).Should(Exit(0)) + + pull := podmanTest.Podman([]string{"pull", "-q", ALPINE}) + pull.WaitWithDefaultTimeout() + Expect(pull).Should(Exit(0)) + + Expect(pull.OutputToString()).To(ContainSubstring(shortImageID)) + }) + + It("podman pull check all tags", func() { + session := podmanTest.Podman([]string{"pull", "--all-tags", "k8s.gcr.io/pause"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + session = podmanTest.Podman([]string{"images"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 4)) + }) + + It("podman pull from docker with nonexistent --authfile", func() { + session := podmanTest.Podman([]string{"pull", "--authfile", "/tmp/nonexistent", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session).To(ExitWithError()) + }) + It("podman pull by digest (image list)", func() { session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() @@ -362,42 +398,6 @@ var _ = Describe("Podman pull", func() { Expect(session.LineInOutputContainsTag(filepath.Join("localhost", dirpath), "latest")).To(BeTrue()) }) - It("podman pull check quiet", func() { - err := podmanTest.RestoreArtifact(ALPINE) - Expect(err).ToNot(HaveOccurred()) - setup := podmanTest.Podman([]string{"images", ALPINE, "-q", "--no-trunc"}) - setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) - shortImageID := strings.Split(setup.OutputToString(), ":")[1] - - rmi := podmanTest.Podman([]string{"rmi", ALPINE}) - rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) - - pull := podmanTest.Podman([]string{"pull", "-q", ALPINE}) - pull.WaitWithDefaultTimeout() - Expect(pull).Should(Exit(0)) - - Expect(pull.OutputToString()).To(ContainSubstring(shortImageID)) - }) - - It("podman pull check all tags", func() { - session := podmanTest.Podman([]string{"pull", "--all-tags", "k8s.gcr.io/pause"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) - - session = podmanTest.Podman([]string{"images"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) - Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 4)) - }) - - It("podman pull from docker with nonexistent --authfile", func() { - session := podmanTest.Podman([]string{"pull", "--authfile", "/tmp/nonexistent", ALPINE}) - session.WaitWithDefaultTimeout() - Expect(session).To(ExitWithError()) - }) - It("podman pull + inspect from unqualified-search registry", func() { // Regression test for #6381: // Make sure that `pull shortname` and `inspect shortname` -- cgit v1.2.3-54-g00ecf From 140fb3ae1743e5ae5e94a18a29d53ea819471435 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 5 May 2022 10:47:32 +0200 Subject: e2e: pull_test: squash --quiet test Squash the --quiet test into another one. The test was more complex than necessary and can easily be squashed into another one to avoid one more expensive pull. Signed-off-by: Valentin Rothberg --- test/e2e/pull_test.go | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 0eff9a550..20f0a6b38 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -5,7 +5,6 @@ import ( "os" "path/filepath" "runtime" - "strings" . "github.com/containers/podman/v4/test/utils" . "github.com/onsi/ginkgo" @@ -59,10 +58,16 @@ var _ = Describe("Podman pull", func() { Expect(session).To(ExitWithError()) }) - It("podman pull with tag", func() { - session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2:20200210"}) + It("podman pull with tag --quiet", func() { + session := podmanTest.Podman([]string{"pull", "-q", "quay.io/libpod/testdigest_v2s2:20200210"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) + quietOutput := session.OutputToString() + + session = podmanTest.Podman([]string{"inspect", "testdigest_v2s2:20200210", "--format", "{{.ID}}"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(Equal(quietOutput)) session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2:20200210"}) session.WaitWithDefaultTimeout() @@ -94,25 +99,6 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(Exit(0)) }) - It("podman pull check quiet", func() { - err := podmanTest.RestoreArtifact(ALPINE) - Expect(err).ToNot(HaveOccurred()) - setup := podmanTest.Podman([]string{"images", ALPINE, "-q", "--no-trunc"}) - setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) - shortImageID := strings.Split(setup.OutputToString(), ":")[1] - - rmi := podmanTest.Podman([]string{"rmi", ALPINE}) - rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) - - pull := podmanTest.Podman([]string{"pull", "-q", ALPINE}) - pull.WaitWithDefaultTimeout() - Expect(pull).Should(Exit(0)) - - Expect(pull.OutputToString()).To(ContainSubstring(shortImageID)) - }) - It("podman pull check all tags", func() { session := podmanTest.Podman([]string{"pull", "--all-tags", "k8s.gcr.io/pause"}) session.WaitWithDefaultTimeout() -- cgit v1.2.3-54-g00ecf From 6ddccd94f69df853a88901e361792ded9eff1f91 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 5 May 2022 10:55:30 +0200 Subject: e2e: pull_test: speed up --all-tags Pulling the K8s pause image seems unnecessarily expensive to me. Let's use the testgitest_v2s2 one which is under our control and weighs only a couple of KB. This cut the execution time in less than half on my machine. Since it's network bound and I am running on fibre, I expect more significant speed ups in slower networks. Signed-off-by: Valentin Rothberg --- test/e2e/pull_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/e2e') diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 20f0a6b38..55e8d637b 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -100,14 +100,14 @@ var _ = Describe("Podman pull", func() { }) It("podman pull check all tags", func() { - session := podmanTest.Podman([]string{"pull", "--all-tags", "k8s.gcr.io/pause"}) + session := podmanTest.Podman([]string{"pull", "--all-tags", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"images"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 4)) + Expect(len(session.OutputToStringArray())).To(BeNumerically(">=", 2), "Expected at least two images") }) It("podman pull from docker with nonexistent --authfile", func() { -- cgit v1.2.3-54-g00ecf