From 8e743fa1dd352239feeb301ea959828db7ccb85c Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 21 Sep 2023 06:18:58 -0600 Subject: [PATCH 1/2] e2e: ExitCleanly(): a few more Commit 1 of 2: automated string replace Exit(0) -> ExitCleanly() Signed-off-by: Ed Santiago --- test/e2e/load_test.go | 86 +++++++++--------- test/e2e/login_logout_test.go | 91 ++++++++++--------- test/e2e/pull_test.go | 162 +++++++++++++++++----------------- test/e2e/push_test.go | 88 +++++++++--------- test/e2e/save_test.go | 41 +++++---- 5 files changed, 233 insertions(+), 235 deletions(-) diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index 00f4f2ab13..541f847648 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -25,15 +25,15 @@ var _ = Describe("Podman load", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", ALPINE}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "-i", outfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) }) It("podman load compressed tar file", func() { @@ -41,19 +41,19 @@ var _ = Describe("Podman load", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) compress := SystemExec("gzip", []string{outfile}) - Expect(compress).Should(Exit(0)) + Expect(compress).Should(ExitCleanly()) outfile += ".gz" rmi := podmanTest.Podman([]string{"rmi", ALPINE}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "-i", outfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) }) It("podman load oci-archive image", func() { @@ -61,15 +61,15 @@ var _ = Describe("Podman load", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", ALPINE}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "-i", outfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) }) It("podman load oci-archive with signature", func() { @@ -77,11 +77,11 @@ var _ = Describe("Podman load", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", ALPINE}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "--signature-policy", "/etc/containers/policy.json", "-i", outfile}) result.WaitWithDefaultTimeout() @@ -90,9 +90,9 @@ var _ = Describe("Podman load", func() { Expect(result.ErrorToString()).To(ContainSubstring("unknown flag")) result = podmanTest.Podman([]string{"load", "-i", outfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) } else { - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) } }) @@ -101,15 +101,15 @@ var _ = Describe("Podman load", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", ALPINE}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) }) It("podman load directory", func() { @@ -118,15 +118,15 @@ var _ = Describe("Podman load", func() { save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", ALPINE}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "-i", outdir}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) }) It("podman-remote load directory", func() { @@ -159,45 +159,45 @@ var _ = Describe("Podman load", func() { pull := podmanTest.Podman([]string{"pull", alpVersion}) pull.WaitWithDefaultTimeout() - Expect(pull).Should(Exit(0)) + Expect(pull).Should(ExitCleanly()) save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE, alpVersion}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", ALPINE, alpVersion}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "-i", outfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", ALPINE}) inspect.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) inspect = podmanTest.Podman([]string{"inspect", alpVersion}) inspect.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) }) It("podman load localhost registry from scratch", func() { outfile := filepath.Join(podmanTest.TempDir, "load_test.tar.gz") setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello:world"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"rmi", "hello:world"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) load := podmanTest.Podman([]string{"load", "-i", outfile}) load.WaitWithDefaultTimeout() - Expect(load).Should(Exit(0)) + Expect(load).Should(ExitCleanly()) result := podmanTest.Podman([]string{"images", "hello:world"}) result.WaitWithDefaultTimeout() @@ -210,19 +210,19 @@ var _ = Describe("Podman load", func() { setup := podmanTest.Podman([]string{"tag", ALPINE, "hello"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"rmi", "hello"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) load := podmanTest.Podman([]string{"load", "-i", outfile}) load.WaitWithDefaultTimeout() - Expect(load).Should(Exit(0)) + Expect(load).Should(ExitCleanly()) result := podmanTest.Podman([]string{"images", "hello:latest"}) result.WaitWithDefaultTimeout() @@ -236,19 +236,19 @@ var _ = Describe("Podman load", func() { setup := podmanTest.Podman([]string{"tag", ALPINE, "hello:world"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-dir", "hello:world"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"rmi", "hello:world"}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) load := podmanTest.Podman([]string{"load", "-i", outfile}) load.WaitWithDefaultTimeout() - Expect(load).Should(Exit(0)) + Expect(load).Should(ExitCleanly()) Expect(load.OutputToString()).To(ContainSubstring("Loaded image: sha256:")) }) @@ -257,23 +257,23 @@ var _ = Describe("Podman load", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) session := SystemExec("xz", []string{outfile}) - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", ALPINE}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) result := podmanTest.Podman([]string{"load", "-i", outfile + ".xz"}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) }) It("podman load multi-image archive", func() { result := podmanTest.Podman([]string{"load", "-i", "./testdata/docker-two-images.tar.xz"}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) Expect(result.OutputToString()).To(ContainSubstring("example.com/empty:latest")) Expect(result.OutputToString()).To(ContainSubstring("example.com/empty/but:different")) }) diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go index 54960b8d31..d423355125 100644 --- a/test/e2e/login_logout_test.go +++ b/test/e2e/login_logout_test.go @@ -11,7 +11,6 @@ import ( . "github.com/containers/podman/v4/test/utils" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gexec" ) var _ = Describe("Podman login and logout", func() { @@ -32,7 +31,7 @@ var _ = Describe("Podman login and logout", func() { htpasswd := SystemExec("htpasswd", []string{"-Bbn", "podmantest", "test"}) htpasswd.WaitWithDefaultTimeout() - Expect(htpasswd).Should(Exit(0)) + Expect(htpasswd).Should(ExitCleanly()) f, err := os.Create(filepath.Join(authPath, "htpasswd")) Expect(err).ToNot(HaveOccurred()) @@ -65,7 +64,7 @@ var _ = Describe("Podman login and logout", func() { "-v", strings.Join([]string{certPath, "/certs:Z"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt", "-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", REGISTRY_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { Skip("Cannot start docker registry.") @@ -105,7 +104,7 @@ var _ = Describe("Podman login and logout", func() { session := podmanTest.Podman([]string{"login", "-u", "podmantest", "-p", "test", server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Confirm that file was created, with the desired credentials auths := readAuthInfo(authFile) @@ -115,11 +114,11 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"push", ALPINE, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"logout", server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, testImg}) session.WaitWithDefaultTimeout() @@ -150,18 +149,18 @@ var _ = Describe("Podman login and logout", func() { session := podmanTest.Podman([]string{"login", "-u", "podmantest", "-p", "test"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"logout"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman login and logout with flag --authfile", func() { authFile := filepath.Join(podmanTest.TempDir, "auth.json") session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--authfile", authFile, server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) readAuthInfo(authFile) @@ -173,11 +172,11 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"push", "--authfile", authFile, ALPINE, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"run", "--authfile", authFile, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // logout should fail with nonexistent authfile session = podmanTest.Podman([]string{"logout", "--authfile", "/tmp/nonexistent", server}) @@ -187,7 +186,7 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"logout", "--authfile", authFile, server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman manifest with --authfile", func() { @@ -196,13 +195,13 @@ var _ = Describe("Podman login and logout", func() { authFile := filepath.Join(podmanTest.TempDir, "auth.json") session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--authfile", authFile, server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) readAuthInfo(authFile) session = podmanTest.Podman([]string{"manifest", "create", testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"manifest", "push", testImg}) session.WaitWithDefaultTimeout() @@ -211,12 +210,12 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"manifest", "push", "--authfile", authFile, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Now remove the local manifest to trigger remote inspection session = podmanTest.Podman([]string{"manifest", "rm", testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"manifest", "inspect", testImg}) session.WaitWithDefaultTimeout() @@ -225,21 +224,21 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"manifest", "inspect", "--authfile", authFile, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman login and logout with --tls-verify", func() { session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--tls-verify=false", server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"logout", server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman login and logout with --cert-dir", func() { certDir := filepath.Join(podmanTest.TempDir, "certs") @@ -251,15 +250,15 @@ var _ = Describe("Podman login and logout", func() { session := podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "--cert-dir", certDir, server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", "--cert-dir", certDir, ALPINE, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"logout", server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman login and logout with multi registry", func() { certDir := filepath.Join(os.Getenv("HOME"), ".config/containers/certs.d", "localhost:9001") @@ -282,7 +281,7 @@ var _ = Describe("Podman login and logout", func() { "-v", strings.Join([]string{certPath, "/certs:z"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt", "-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", REGISTRY_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !WaitContainerReady(podmanTest, "registry1", "listening on", 20, 1) { Skip("Cannot start docker registry.") @@ -290,11 +289,11 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"}) session.WaitWithDefaultTimeout() @@ -303,19 +302,19 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "localhost:9001"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, testImg}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"logout", server}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, testImg}) session.WaitWithDefaultTimeout() @@ -324,15 +323,15 @@ var _ = Describe("Podman login and logout", func() { session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"login", "--username", "podmantest", "--password", "test", "localhost:9001"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"logout", "-a"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", ALPINE, testImg}) session.WaitWithDefaultTimeout() @@ -357,7 +356,7 @@ var _ = Describe("Podman login and logout", func() { testRepository, }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) authInfo := readAuthInfo(authFile) Expect(authInfo).To(HaveKey(testRepository)) @@ -368,7 +367,7 @@ var _ = Describe("Podman login and logout", func() { testRepository, }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) authInfo = readAuthInfo(authFile) Expect(authInfo).NotTo(HaveKey(testRepository)) @@ -386,7 +385,7 @@ var _ = Describe("Podman login and logout", func() { testTarget, }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) authInfo := readAuthInfo(authFile) Expect(authInfo).To(HaveKey(testTarget)) @@ -397,7 +396,7 @@ var _ = Describe("Podman login and logout", func() { ALPINE, testTarget, }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) @@ -417,7 +416,7 @@ var _ = Describe("Podman login and logout", func() { testRepo, }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) } authInfo := readAuthInfo(authFile) @@ -430,7 +429,7 @@ var _ = Describe("Podman login and logout", func() { ALPINE, testRepos[0] + "/test-image-alpine", }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{ "logout", @@ -438,7 +437,7 @@ var _ = Describe("Podman login and logout", func() { testRepos[0], }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{ "push", @@ -446,7 +445,7 @@ var _ = Describe("Podman login and logout", func() { ALPINE, testRepos[0] + "/test-image-alpine", }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{ "logout", @@ -454,7 +453,7 @@ var _ = Describe("Podman login and logout", func() { testRepos[1], }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) authInfo = readAuthInfo(authFile) Expect(authInfo).NotTo(HaveKey(testRepos[0])) @@ -476,7 +475,7 @@ var _ = Describe("Podman login and logout", func() { invalidArg, }) session.WaitWithDefaultTimeout() - Expect(session).To(Exit(0)) + Expect(session).To(ExitCleanly()) } }) @@ -504,7 +503,7 @@ var _ = Describe("Podman login and logout", func() { ALPINE, server + "/test-image", }) session.WaitWithDefaultTimeout() - Expect(session).To(Exit(0)) + Expect(session).To(ExitCleanly()) }) It("podman login and logout with repository pull with wrong auth.json credentials", func() { @@ -519,7 +518,7 @@ var _ = Describe("Podman login and logout", func() { testTarget, }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{ "push", @@ -527,7 +526,7 @@ var _ = Describe("Podman login and logout", func() { ALPINE, testTarget, }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // only `server + /podmantest` and `server` have the correct login data err := os.WriteFile(authFile, []byte(fmt.Sprintf(`{"auths": { diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 20ea46ad14..3dbb852d94 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -17,7 +17,7 @@ var _ = Describe("Podman pull", func() { It("podman pull multiple images with/without tag/digest", func() { session := podmanTest.Podman([]string{"pull", "busybox:musl", "alpine", "alpine:latest", "quay.io/libpod/cirros", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"pull", "busybox:latest", "docker.io/library/ibetthisdoesnotexistfr:random", "alpine"}) session.WaitWithDefaultTimeout() @@ -27,7 +27,7 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"rmi", "busybox:musl", "alpine", "quay.io/libpod/cirros", "testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull bogus image", func() { @@ -39,27 +39,27 @@ var _ = Describe("Podman pull", func() { 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)) + Expect(session).Should(ExitCleanly()) quietOutput := session.OutputToString() session = podmanTest.Podman([]string{"inspect", "testdigest_v2s2:20200210", "--format", "{{.ID}}"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal(quietOutput)) session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2:20200210"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull without tag", func() { session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull and run on split imagestore", func() { @@ -69,44 +69,44 @@ var _ = Describe("Podman pull", func() { // Make alpine write-able session := podmanTest.Podman([]string{"build", "--pull=never", "--tag", imgName, "build/basicalpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) tmpDir := filepath.Join(podmanTest.TempDir, "splitstore") outfile := filepath.Join(podmanTest.TempDir, "image.tar") save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", imgName}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", imgName}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) // load to splitstore result := podmanTest.Podman([]string{"load", "--imagestore", tmpDir, "-q", "-i", outfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) // tag busybox to busybox-test in graphroot since we can delete readonly busybox session = podmanTest.Podman([]string{"tag", "quay.io/libpod/busybox:latest", "busybox-test"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"images", "--imagestore", tmpDir}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(ContainSubstring(imgName)) Expect(session.OutputToString()).To(ContainSubstring("busybox-test")) // Test deleting image in graphroot even when `--imagestore` is set session = podmanTest.Podman([]string{"rmi", "--imagestore", tmpDir, "busybox-test"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Images without --imagestore should not contain alpine session = podmanTest.Podman([]string{"images"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Not(ContainSubstring(imgName))) // Set `imagestore` in `storage.conf` and container should run. @@ -125,14 +125,14 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"run", "--name", "test", "--rm", imgName, "echo", "helloworld"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(ContainSubstring("helloworld")) }) It("podman pull by digest", func() { session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Without a tag/digest the input is normalized with the "latest" tag, see #11964 session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2"}) @@ -141,26 +141,26 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"rmi", "testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull check all tags", func() { session := podmanTest.Podman([]string{"pull", "--all-tags", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"images"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(len(session.OutputToStringArray())).To(BeNumerically(">=", 2), "Expected at least two images") session = podmanTest.Podman([]string{"pull", "-a", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"images"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(len(session.OutputToStringArray())).To(BeNumerically(">=", 2), "Expected at least two images") }) @@ -173,50 +173,50 @@ var _ = Describe("Podman pull", func() { It("podman pull by digest (image list)", func() { session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // inspect using the digest of the list session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(HavePrefix("[]")) // inspect using the digest of the list session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST)) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // inspect using the digest of the arch-specific image's manifest session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(HavePrefix("[]")) // inspect using the digest of the arch-specific image's manifest session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST)) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // inspect using the image ID session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(HavePrefix("[]")) // inspect using the image ID session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST)) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // remove using the digest of the list session = podmanTest.Podman([]string{"rmi", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull by instance digest (image list)", func() { session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // inspect using the digest of the list session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() @@ -228,83 +228,83 @@ var _ = Describe("Podman pull", func() { // inspect using the digest of the arch-specific image's manifest session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(HavePrefix("[]")) // inspect using the digest of the arch-specific image's manifest session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(Not(ContainSubstring(ALPINELISTDIGEST))) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // inspect using the image ID session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(HavePrefix("[]")) // inspect using the image ID session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(Not(ContainSubstring(ALPINELISTDIGEST))) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // remove using the digest of the instance session = podmanTest.Podman([]string{"rmi", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull by tag (image list)", func() { session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINELISTTAG}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // inspect using the tag we used for pulling session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTTAG}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG)) // inspect using the tag we used for pulling session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTTAG}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST)) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // inspect using the digest of the list session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG)) // inspect using the digest of the list session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST)) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // inspect using the digest of the arch-specific image's manifest session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG)) // inspect using the digest of the arch-specific image's manifest session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST)) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // inspect using the image ID session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoTags}}", ALPINEARM64ID}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTTAG)) // inspect using the image ID session = podmanTest.Podman([]string{"inspect", "--format", "{{.RepoDigests}}", ALPINEARM64ID}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINELISTDIGEST)) Expect(string(session.Out.Contents())).To(ContainSubstring(ALPINEARM64DIGEST)) // remove using the tag session = podmanTest.Podman([]string{"rmi", ALPINELISTTAG}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull from docker-archive", func() { @@ -315,16 +315,16 @@ var _ = Describe("Podman pull", func() { session := podmanTest.Podman([]string{"save", "-o", tarfn, "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:%s", tarfn)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Pulling a multi-image archive without further specifying // which image _must_ error out. Pulling is restricted to one @@ -339,19 +339,19 @@ var _ = Describe("Podman pull", func() { // and index syntax. session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@0"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty:latest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@1"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty/but:different"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Now check for some errors. session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:foo.com/does/not/exist:latest"}) @@ -375,16 +375,16 @@ var _ = Describe("Podman pull", func() { session := podmanTest.Podman([]string{"save", "--format", "oci-archive", "-o", tarfn, "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"pull", fmt.Sprintf("oci-archive:%s", tarfn)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull from local directory", func() { @@ -398,13 +398,13 @@ var _ = Describe("Podman pull", func() { session := podmanTest.Podman([]string{"push", "cirros", imgPath}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"run", imgPath, "ls"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Note that reference is not preserved in dir. session = podmanTest.Podman([]string{"image", "exists", "cirros"}) session.WaitWithDefaultTimeout() @@ -423,16 +423,16 @@ var _ = Describe("Podman pull", func() { session := podmanTest.Podman([]string{"push", "cirros", imgPath}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"pull", imgPath}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"image", "exists", imgName}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman pull + inspect from unqualified-search registry", func() { @@ -456,7 +456,7 @@ var _ = Describe("Podman pull", func() { getID := func(image string) string { setup := podmanTest.Podman([]string{"image", "inspect", image}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) data := setup.InspectImageJSON() // returns []inspect.ImageData Expect(data).To(HaveLen(1)) @@ -466,11 +466,11 @@ var _ = Describe("Podman pull", func() { untag := func(image string) { setup := podmanTest.Podman([]string{"untag", image}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"image", "inspect", image}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) data := setup.InspectImageJSON() // returns []inspect.ImageData Expect(data).To(HaveLen(1)) @@ -480,10 +480,10 @@ var _ = Describe("Podman pull", func() { tag := func(image, tag string) { setup := podmanTest.Podman([]string{"tag", image, tag}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) setup = podmanTest.Podman([]string{"image", "exists", tag}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) } image1 := getID(ALPINE) @@ -524,7 +524,7 @@ var _ = Describe("Podman pull", func() { setup := podmanTest.Podman([]string{"image", "inspect", name}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) data := setup.InspectImageJSON() // returns []inspect.ImageData Expect(data).To(HaveLen(1)) @@ -549,11 +549,11 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"pull", "-q", "--platform=linux/arm64", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) setup := podmanTest.Podman([]string{"image", "inspect", session.OutputToString()}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) data := setup.InspectImageJSON() // returns []inspect.ImageData Expect(data).To(HaveLen(1)) @@ -576,11 +576,11 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"pull", "-q", "--arch=arm64", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) setup := podmanTest.Podman([]string{"image", "inspect", session.OutputToString()}) setup.WaitWithDefaultTimeout() - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) data := setup.InspectImageJSON() // returns []inspect.ImageData Expect(data).To(HaveLen(1)) @@ -591,14 +591,14 @@ var _ = Describe("Podman pull", func() { It("podman pull progress", func() { session := podmanTest.Podman([]string{"pull", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) output := session.ErrorToString() Expect(output).To(ContainSubstring("Getting image source signatures")) Expect(output).To(ContainSubstring("Copying blob ")) session = podmanTest.Podman([]string{"pull", "-q", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.ErrorToString()).To(BeEmpty()) }) @@ -619,7 +619,7 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"rmi", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Pulling encrypted image without key should fail session = podmanTest.Podman([]string{"pull", imgPath}) @@ -634,10 +634,10 @@ var _ = Describe("Podman pull", func() { // Pulling encrypted image with correct key should pass session = podmanTest.Podman([]string{"pull", "--decryption-key", privateKeyFileName, imgPath}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"images"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) return session } @@ -673,7 +673,7 @@ var _ = Describe("Podman pull", func() { defer lock.Unlock() session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { Skip("Cannot start docker registry.") diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index 3073b161a6..2971fc51a3 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -24,11 +24,11 @@ var _ = Describe("Podman push", func() { SkipIfRemote("Remote push does not support containers-storage transport") session := podmanTest.Podman([]string{"push", ALPINE, "containers-storage:busybox:test"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman push to dir", func() { @@ -37,13 +37,13 @@ var _ = Describe("Podman push", func() { session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE, fmt.Sprintf("dir:%s", bbdir)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) bbdir = filepath.Join(podmanTest.TempDir, "busybox") session = podmanTest.Podman([]string{"push", "--format", "oci", ALPINE, fmt.Sprintf("dir:%s", bbdir)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman push to oci with compression-format and compression-level", func() { @@ -60,7 +60,7 @@ var _ = Describe("Podman push", func() { session = podmanTest.Podman([]string{"push", "--compression-format=zstd", "--remove-signatures", ALPINE, fmt.Sprintf("oci:%s", bbdir)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) foundZstdFile := false @@ -96,7 +96,7 @@ var _ = Describe("Podman push", func() { defer lock.Unlock() session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { Skip("Cannot start docker registry.") @@ -104,26 +104,26 @@ var _ = Describe("Podman push", func() { session = podmanTest.Podman([]string{"build", "-t", "imageone", "build/basicalpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", "imageone", "localhost:5000/image"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", "quay.io/skopeo/stable", "inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/image:latest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) output := session.OutputToString() // Default compression is gzip and push with `--force-compression=false` no traces of `zstd` should be there. Expect(output).ToNot(ContainSubstring("zstd")) push = podmanTest.Podman([]string{"push", "--tls-verify=false", "--force-compression=false", "--compression-format", "zstd", "--remove-signatures", "imageone", "localhost:5000/image"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", "quay.io/skopeo/stable", "inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/image:latest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) output = session.OutputToString() // Although `--compression-format` is `zstd` but still no traces of `zstd` should be in image // since blobs must be reused from last `gzip` image. @@ -131,11 +131,11 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "--tls-verify=false", "--compression-format", "zstd", "--force-compression", "--remove-signatures", "imageone", "localhost:5000/image"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", "quay.io/skopeo/stable", "inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/image:latest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) output = session.OutputToString() // Should contain `zstd` layer, substring `zstd` is enough to confirm in skopeo inspect output that `zstd` layer is present. Expect(output).To(ContainSubstring("zstd")) @@ -153,7 +153,7 @@ var _ = Describe("Podman push", func() { defer lock.Unlock() session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { Skip("Cannot start docker registry.") @@ -161,12 +161,12 @@ var _ = Describe("Podman push", func() { push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(BeEmpty()) push = podmanTest.Podman([]string{"push", "--compression-format=gzip", "--compression-level=1", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) output := push.ErrorToString() Expect(output).To(ContainSubstring("Copying blob ")) Expect(output).To(ContainSubstring("Copying config ")) @@ -180,7 +180,7 @@ var _ = Describe("Podman push", func() { if !IsRemote() { // Remote does not support --encryption-key push = podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) } // Test --digestfile option @@ -190,7 +190,7 @@ var _ = Describe("Podman push", func() { fi, err := os.Lstat(digestFile) Expect(err).ToNot(HaveOccurred()) Expect(fi.Name()).To(Equal("digestfile.txt")) - Expect(push2).Should(Exit(0)) + Expect(push2).Should(ExitCleanly()) if !IsRemote() { // Remote does not support signing By("pushing and pulling with --sign-by-sigstore-private-key") @@ -214,7 +214,7 @@ var _ = Describe("Podman push", func() { // Verify that the policy rejects unsigned images push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/sigstore-signed"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(BeEmpty()) pull := podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed"}) @@ -225,18 +225,18 @@ var _ = Describe("Podman push", func() { // Sign an image, and verify it is accepted. push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", "--sign-by-sigstore-private-key", "testdata/sigstore-key.key", "--sign-passphrase-file", "testdata/sigstore-key.key.pass", ALPINE, "localhost:5000/sigstore-signed"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(BeEmpty()) pull = podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed"}) pull.WaitWithDefaultTimeout() - Expect(pull).Should(Exit(0)) + Expect(pull).Should(ExitCleanly()) By("pushing and pulling with --sign-by-sigstore") // Verify that the policy rejects unsigned images push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/sigstore-signed-params"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(BeEmpty()) pull = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed-params"}) @@ -247,12 +247,12 @@ var _ = Describe("Podman push", func() { // Sign an image, and verify it is accepted. push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", "--sign-by-sigstore", "testdata/sigstore-signing-params.yaml", ALPINE, "localhost:5000/sigstore-signed-params"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(BeEmpty()) pull = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed-params"}) pull.WaitWithDefaultTimeout() - Expect(pull).Should(Exit(0)) + Expect(pull).Should(ExitCleanly()) } } }) @@ -263,12 +263,12 @@ var _ = Describe("Podman push", func() { inspect := podmanTest.Podman([]string{"inspect", "--format={{.ID}}", ALPINE}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) imageID := inspect.OutputToString() push := podmanTest.Podman([]string{"push", "--signature-policy", denyAllPolicy, "-q", imageID, "dir:" + filepath.Join(podmanTest.TempDir, imageID)}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(BeEmpty()) }) @@ -291,7 +291,7 @@ var _ = Describe("Podman push", func() { defer lock.Unlock() htpasswd := SystemExec("htpasswd", []string{"-Bbn", "podmantest", "test"}) htpasswd.WaitWithDefaultTimeout() - Expect(htpasswd).Should(Exit(0)) + Expect(htpasswd).Should(ExitCleanly()) f, err := os.Create(filepath.Join(authPath, "htpasswd")) Expect(err).ToNot(HaveOccurred()) @@ -308,7 +308,7 @@ var _ = Describe("Podman push", func() { "-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt", "-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", REGISTRY_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { Skip("Cannot start docker registry.") @@ -324,11 +324,11 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", "--tls-verify=false", ALPINE, "localhost:5000/tlstest"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(ContainSubstring("Writing manifest to image destination")) setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"}) - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"}) push.WaitWithDefaultTimeout() @@ -345,17 +345,17 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/defaultflags"}) push.WaitWithDefaultTimeout() - Expect(push).Should(Exit(0)) + Expect(push).Should(ExitCleanly()) Expect(push.ErrorToString()).To(ContainSubstring("Writing manifest to image destination")) // create and push manifest session = podmanTest.Podman([]string{"manifest", "create", "localhost:5000/manifesttest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"manifest", "push", "--creds=podmantest:test", "--tls-verify=false", "--all", "localhost:5000/manifesttest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.ErrorToString()).To(ContainSubstring("Writing manifest list to image destination")) }) @@ -371,11 +371,11 @@ var _ = Describe("Podman push", func() { session := podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, ALPINE, fmt.Sprintf("oci:%s", bbdir)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman push to docker-archive", func() { @@ -384,7 +384,7 @@ var _ = Describe("Podman push", func() { session := podmanTest.Podman([]string{"push", ALPINE, fmt.Sprintf("docker-archive:%s:latest", tarfn)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman push to docker daemon", func() { @@ -394,10 +394,10 @@ var _ = Describe("Podman push", func() { if setup.LineInOutputContains("Active: inactive") { setup = SystemExec("systemctl", []string{"start", "docker"}) - Expect(setup).Should(Exit(0)) + Expect(setup).Should(ExitCleanly()) defer func() { stop := SystemExec("systemctl", []string{"stop", "docker"}) - Expect(stop).Should(Exit(0)) + Expect(stop).Should(ExitCleanly()) }() } else if setup.ExitCode() != 0 { Skip("Docker is not available") @@ -405,14 +405,14 @@ var _ = Describe("Podman push", func() { session := podmanTest.Podman([]string{"push", ALPINE, "docker-daemon:alpine:podmantest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) check := SystemExec("docker", []string{"images", "--format", "{{.Repository}}:{{.Tag}}"}) - Expect(check).Should(Exit(0)) + Expect(check).Should(ExitCleanly()) Expect(check.OutputToString()).To(ContainSubstring("alpine:podmantest")) clean := SystemExec("docker", []string{"rmi", "alpine:podmantest"}) - Expect(clean).Should(Exit(0)) + Expect(clean).Should(ExitCleanly()) }) It("podman push to oci-archive", func() { @@ -421,7 +421,7 @@ var _ = Describe("Podman push", func() { session := podmanTest.Podman([]string{"push", ALPINE, fmt.Sprintf("oci-archive:%s:latest", tarfn)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman push to docker-archive no reference", func() { @@ -430,7 +430,7 @@ var _ = Describe("Podman push", func() { session := podmanTest.Podman([]string{"push", ALPINE, fmt.Sprintf("docker-archive:%s", tarfn)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) It("podman push to oci-archive no reference", func() { @@ -440,7 +440,7 @@ var _ = Describe("Podman push", func() { fmt.Sprintf("oci-archive:%s", ociarc)}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) }) diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go index b155aaf0a5..4fbdb8aa85 100644 --- a/test/e2e/save_test.go +++ b/test/e2e/save_test.go @@ -10,7 +10,6 @@ import ( . "github.com/containers/podman/v4/test/utils" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gexec" ) var _ = Describe("Podman save", func() { @@ -20,7 +19,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) }) It("podman save signature-policy flag", func() { @@ -29,7 +28,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", "--signature-policy", "/etc/containers/policy.json", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) }) It("podman save oci flag", func() { @@ -37,7 +36,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) }) It("podman save with stdout", func() { @@ -46,7 +45,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", ALPINE, ">", outfile}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) }) It("podman save quiet flag", func() { @@ -54,7 +53,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) }) It("podman save bogus image", func() { @@ -70,7 +69,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) // Smoke test if it looks like an OCI dir Expect(filepath.Join(outdir, "oci-layout")).Should(BeAnExistingFile()) @@ -83,7 +82,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", "--format", "docker-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) // Smoke test if it looks like a docker dir Expect(filepath.Join(outdir, "version")).Should(BeAnExistingFile()) @@ -94,7 +93,7 @@ var _ = Describe("Podman save", func() { save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) }) It("podman save to directory with --compress but not use docker-dir and oci-dir", func() { @@ -140,7 +139,7 @@ var _ = Describe("Podman save", func() { session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", strings.Join([]string{strconv.Itoa(port), strconv.Itoa(port)}, ":"), REGISTRY_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { Skip("Cannot start docker registry.") } @@ -176,15 +175,15 @@ default-docker: session = podmanTest.Podman([]string{"tag", ALPINE, "localhost:5000/alpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"push", "--tls-verify=false", "--sign-by", "foo@bar.com", "localhost:5000/alpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", ALPINE, "localhost:5000/alpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) if !IsRemote() { // Generate a signature verification policy file @@ -193,7 +192,7 @@ default-docker: session = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/alpine"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) outfile := filepath.Join(podmanTest.TempDir, "temp.tar") save := podmanTest.Podman([]string{"save", "remove-signatures=true", "-o", outfile, "localhost:5000/alpine"}) @@ -206,13 +205,13 @@ default-docker: // pull a digest reference session := podmanTest.Podman([]string{"pull", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // save a digest reference should exit without error. outfile := filepath.Join(podmanTest.TempDir, "temp.tar") save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINELISTDIGEST}) save.WaitWithDefaultTimeout() - Expect(save).Should(Exit(0)) + Expect(save).Should(ExitCleanly()) }) It("podman save --multi-image-archive (tagged images)", func() { @@ -224,7 +223,7 @@ default-docker: // most three images and sort them by size. session := podmanTest.Podman([]string{"images", "--sort", "size", "--format", "{{.ID}}"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) ids := session.OutputToStringArray() Expect(len(ids)).To(BeNumerically(">", 1), "We need to have *some* images to save") @@ -242,17 +241,17 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) { outfile := filepath.Join(podmanTest.TempDir, "temp.tar") session := podmanTest.Podman(append([]string{"save", "-o", outfile, "--multi-image-archive"}, images...)) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Remove all images. session = podmanTest.Podman([]string{"rmi", "-af"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Now load the archive. session = podmanTest.Podman([]string{"load", "-i", outfile}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) // Grep for each image in the `podman load` output. for _, image := range images { Expect(session.OutputToString()).To(ContainSubstring(image)) @@ -262,6 +261,6 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) { for _, image := range images { session = podmanTest.Podman([]string{"image", "exists", image}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) } } From 4916f7d771f43661f5b3eb57aaebda108bad9aa0 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 21 Sep 2023 06:31:26 -0600 Subject: [PATCH 2/2] e2e: ExitCleanly(): manual fixes to get tests passing Commit 2 of 2: steps to make tests work under ExitCleanly() Mostly adding "-q" to push/pull, but also: - revert ExitCleanly(), and add error-message checks if absent; - fix a test that was completely nonfunctional from Day One: test was getting skipped because registry couldn't start, because of missing ":z"s in mount option. Fixed, and removed the bypass; - use built-in skopeo, not pulled-container skopeo. Skopeo is already a requirement for system tests. Signed-off-by: Ed Santiago --- test/e2e/load_test.go | 56 +++++++++++++--------- test/e2e/login_logout_test.go | 48 +++++++++---------- test/e2e/pull_test.go | 80 ++++++++++++++++--------------- test/e2e/push_test.go | 89 ++++++++++++++++------------------- test/e2e/save_test.go | 34 ++++++------- 5 files changed, 157 insertions(+), 150 deletions(-) diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index 541f847648..ac2c16cd03 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -23,7 +23,7 @@ var _ = Describe("Podman load", func() { images.WaitWithDefaultTimeout() GinkgoWriter.Println(images.OutputToStringArray()) - save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -31,7 +31,7 @@ var _ = Describe("Podman load", func() { rmi.WaitWithDefaultTimeout() Expect(rmi).Should(ExitCleanly()) - result := podmanTest.Podman([]string{"load", "-i", outfile}) + result := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) }) @@ -39,7 +39,7 @@ var _ = Describe("Podman load", func() { It("podman load compressed tar file", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -51,7 +51,7 @@ var _ = Describe("Podman load", func() { rmi.WaitWithDefaultTimeout() Expect(rmi).Should(ExitCleanly()) - result := podmanTest.Podman([]string{"load", "-i", outfile}) + result := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) }) @@ -59,7 +59,7 @@ var _ = Describe("Podman load", func() { It("podman load oci-archive image", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -67,7 +67,7 @@ var _ = Describe("Podman load", func() { rmi.WaitWithDefaultTimeout() Expect(rmi).Should(ExitCleanly()) - result := podmanTest.Podman([]string{"load", "-i", outfile}) + result := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) }) @@ -75,7 +75,7 @@ var _ = Describe("Podman load", func() { It("podman load oci-archive with signature", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -83,7 +83,7 @@ var _ = Describe("Podman load", func() { rmi.WaitWithDefaultTimeout() Expect(rmi).Should(ExitCleanly()) - result := podmanTest.Podman([]string{"load", "--signature-policy", "/etc/containers/policy.json", "-i", outfile}) + result := podmanTest.Podman([]string{"load", "-q", "--signature-policy", "/etc/containers/policy.json", "-i", outfile}) result.WaitWithDefaultTimeout() if IsRemote() { Expect(result).To(ExitWithError()) @@ -99,7 +99,7 @@ var _ = Describe("Podman load", func() { It("podman load with quiet flag", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -116,7 +116,7 @@ var _ = Describe("Podman load", func() { SkipIfRemote("Remote does not support loading directories") outdir := filepath.Join(podmanTest.TempDir, "alpine") - save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "--format", "oci-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -124,7 +124,7 @@ var _ = Describe("Podman load", func() { rmi.WaitWithDefaultTimeout() Expect(rmi).Should(ExitCleanly()) - result := podmanTest.Podman([]string{"load", "-i", outdir}) + result := podmanTest.Podman([]string{"load", "-q", "-i", outdir}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) }) @@ -157,11 +157,11 @@ var _ = Describe("Podman load", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") alpVersion := "quay.io/libpod/alpine:3.2" - pull := podmanTest.Podman([]string{"pull", alpVersion}) + pull := podmanTest.Podman([]string{"pull", "-q", alpVersion}) pull.WaitWithDefaultTimeout() Expect(pull).Should(ExitCleanly()) - save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE, alpVersion}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE, alpVersion}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -169,7 +169,7 @@ var _ = Describe("Podman load", func() { rmi.WaitWithDefaultTimeout() Expect(rmi).Should(ExitCleanly()) - result := podmanTest.Podman([]string{"load", "-i", outfile}) + result := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) @@ -187,7 +187,7 @@ var _ = Describe("Podman load", func() { setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) - setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello:world"}) + setup = podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", "hello:world"}) setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) @@ -195,7 +195,7 @@ var _ = Describe("Podman load", func() { setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) - load := podmanTest.Podman([]string{"load", "-i", outfile}) + load := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) load.WaitWithDefaultTimeout() Expect(load).Should(ExitCleanly()) @@ -212,7 +212,7 @@ var _ = Describe("Podman load", func() { setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) - setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello"}) + setup = podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", "hello"}) setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) @@ -220,7 +220,7 @@ var _ = Describe("Podman load", func() { setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) - load := podmanTest.Podman([]string{"load", "-i", outfile}) + load := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) load.WaitWithDefaultTimeout() Expect(load).Should(ExitCleanly()) @@ -238,7 +238,7 @@ var _ = Describe("Podman load", func() { setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) - setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-dir", "hello:world"}) + setup = podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-dir", "hello:world"}) setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) @@ -246,7 +246,7 @@ var _ = Describe("Podman load", func() { setup.WaitWithDefaultTimeout() Expect(setup).Should(ExitCleanly()) - load := podmanTest.Podman([]string{"load", "-i", outfile}) + load := podmanTest.Podman([]string{"load", "-q", "-i", outfile}) load.WaitWithDefaultTimeout() Expect(load).Should(ExitCleanly()) Expect(load.OutputToString()).To(ContainSubstring("Loaded image: sha256:")) @@ -255,7 +255,7 @@ var _ = Describe("Podman load", func() { It("podman load xz compressed image", func() { outfile := filepath.Join(podmanTest.TempDir, "alp.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) session := SystemExec("xz", []string{outfile}) @@ -265,7 +265,7 @@ var _ = Describe("Podman load", func() { rmi.WaitWithDefaultTimeout() Expect(rmi).Should(ExitCleanly()) - result := podmanTest.Podman([]string{"load", "-i", outfile + ".xz"}) + result := podmanTest.Podman([]string{"load", "-q", "-i", outfile + ".xz"}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) }) @@ -273,8 +273,18 @@ var _ = Describe("Podman load", func() { It("podman load multi-image archive", func() { result := podmanTest.Podman([]string{"load", "-i", "./testdata/docker-two-images.tar.xz"}) result.WaitWithDefaultTimeout() - Expect(result).Should(ExitCleanly()) + Expect(result).Should(Exit(0)) Expect(result.OutputToString()).To(ContainSubstring("example.com/empty:latest")) Expect(result.OutputToString()).To(ContainSubstring("example.com/empty/but:different")) + + stderr := result.ErrorToString() + if IsRemote() { + Expect(stderr).To(BeEmpty(), "no stderr when running remote") + } else { + Expect(stderr).To(ContainSubstring("Getting image source signatures")) + Expect(stderr).To(ContainSubstring("Copying blob")) + Expect(stderr).To(ContainSubstring("Writing manifest to image destination")) + Expect(stderr).To(ContainSubstring("Copying config sha256:")) + } }) }) diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go index d423355125..38a076d8c8 100644 --- a/test/e2e/login_logout_test.go +++ b/test/e2e/login_logout_test.go @@ -112,7 +112,7 @@ var _ = Describe("Podman login and logout", func() { // base64-encoded "podmantest:test" Expect(auths[server]).To(HaveKeyWithValue("auth", "cG9kbWFudGVzdDp0ZXN0")) - session = podmanTest.Podman([]string{"push", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -120,7 +120,7 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) Expect(session.ErrorToString()).To(ContainSubstring(": authentication required")) @@ -165,16 +165,16 @@ var _ = Describe("Podman login and logout", func() { readAuthInfo(authFile) // push should fail with nonexistent authfile - session = podmanTest.Podman([]string{"push", "--authfile", "/tmp/nonexistent", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", "--authfile", "/tmp/nonexistent", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) Expect(session.ErrorToString()).To(Equal("Error: checking authfile: stat /tmp/nonexistent: no such file or directory")) - session = podmanTest.Podman([]string{"push", "--authfile", authFile, ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", "--authfile", authFile, ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"run", "--authfile", authFile, testImg}) + session = podmanTest.Podman([]string{"run", "-q", "--authfile", authFile, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -203,12 +203,12 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"manifest", "push", testImg}) + session = podmanTest.Podman([]string{"manifest", "push", "-q", testImg}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) Expect(session.ErrorToString()).To(ContainSubstring(": authentication required")) - session = podmanTest.Podman([]string{"manifest", "push", "--authfile", authFile, testImg}) + session = podmanTest.Podman([]string{"manifest", "push", "-q", "--authfile", authFile, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -232,7 +232,7 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -252,7 +252,7 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", "--cert-dir", certDir, ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", "--cert-dir", certDir, ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -291,11 +291,11 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, "localhost:9001/test-alpine"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) Expect(session.ErrorToString()).To(ContainSubstring("/test-alpine: authentication required")) @@ -304,11 +304,11 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, "localhost:9001/test-alpine"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -316,12 +316,12 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) Expect(session.ErrorToString()).To(ContainSubstring("/test-alpine: authentication required")) - session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, "localhost:9001/test-alpine"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -333,12 +333,12 @@ var _ = Describe("Podman login and logout", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", ALPINE, testImg}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, testImg}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) Expect(session.ErrorToString()).To(ContainSubstring("/test-alpine: authentication required")) - session = podmanTest.Podman([]string{"push", ALPINE, "localhost:9001/test-alpine"}) + session = podmanTest.Podman([]string{"push", "-q", ALPINE, "localhost:9001/test-alpine"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) Expect(session.ErrorToString()).To(ContainSubstring("/test-alpine: authentication required")) @@ -391,7 +391,7 @@ var _ = Describe("Podman login and logout", func() { Expect(authInfo).To(HaveKey(testTarget)) session = podmanTest.Podman([]string{ - "push", + "push", "-q", "--authfile", authFile, ALPINE, testTarget, }) @@ -424,7 +424,7 @@ var _ = Describe("Podman login and logout", func() { Expect(authInfo).To(HaveKey(testRepos[1])) session := podmanTest.Podman([]string{ - "push", + "push", "-q", "--authfile", authFile, ALPINE, testRepos[0] + "/test-image-alpine", }) @@ -440,7 +440,7 @@ var _ = Describe("Podman login and logout", func() { Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{ - "push", + "push", "-q", "--authfile", authFile, ALPINE, testRepos[0] + "/test-image-alpine", }) @@ -489,7 +489,7 @@ var _ = Describe("Podman login and logout", func() { Expect(err).ToNot(HaveOccurred()) session := podmanTest.Podman([]string{ - "push", + "push", "-q", "--authfile", authFile, ALPINE, server + "/podmantest/test-image", }) @@ -498,7 +498,7 @@ var _ = Describe("Podman login and logout", func() { Expect(session.ErrorToString()).To(ContainSubstring("/test-image: authentication required")) session = podmanTest.Podman([]string{ - "push", + "push", "-q", "--authfile", authFile, ALPINE, server + "/test-image", }) @@ -521,7 +521,7 @@ var _ = Describe("Podman login and logout", func() { Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{ - "push", + "push", "-q", "--authfile", authFile, ALPINE, testTarget, }) @@ -537,7 +537,7 @@ var _ = Describe("Podman login and logout", func() { Expect(err).ToNot(HaveOccurred()) session = podmanTest.Podman([]string{ - "pull", + "pull", "-q", "--authfile", authFile, server + "/podmantest/test-alpine", }) diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 3dbb852d94..0fea12229e 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -15,7 +15,7 @@ import ( var _ = Describe("Podman pull", func() { It("podman pull multiple images with/without tag/digest", func() { - session := podmanTest.Podman([]string{"pull", "busybox:musl", "alpine", "alpine:latest", "quay.io/libpod/cirros", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) + session := podmanTest.Podman([]string{"pull", "-q", "busybox:musl", "alpine", "alpine:latest", "quay.io/libpod/cirros", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -31,9 +31,11 @@ var _ = Describe("Podman pull", func() { }) It("podman pull bogus image", func() { - session := podmanTest.Podman([]string{"pull", "quay.io/ibetthis/doesntexistthere:foo"}) + session := podmanTest.Podman([]string{"pull", "quay.io/libpod/ibetthisdoesntexist:there"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) + // "Not authorized", not "Not Found", because that's how registries roll?? + Expect(session.ErrorToString()).To(ContainSubstring("unauthorized: access to the requested resource is not authorized")) }) It("podman pull with tag --quiet", func() { @@ -53,7 +55,7 @@ var _ = Describe("Podman pull", func() { }) It("podman pull without tag", func() { - session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2"}) + session := podmanTest.Podman([]string{"pull", "-q", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -74,7 +76,7 @@ var _ = Describe("Podman pull", func() { tmpDir := filepath.Join(podmanTest.TempDir, "splitstore") outfile := filepath.Join(podmanTest.TempDir, "image.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", imgName}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", imgName}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -83,7 +85,7 @@ var _ = Describe("Podman pull", func() { Expect(rmi).Should(ExitCleanly()) // load to splitstore - result := podmanTest.Podman([]string{"load", "--imagestore", tmpDir, "-q", "-i", outfile}) + result := podmanTest.Podman([]string{"load", "-q", "--imagestore", tmpDir, "-q", "-i", outfile}) result.WaitWithDefaultTimeout() Expect(result).Should(ExitCleanly()) @@ -125,12 +127,14 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"run", "--name", "test", "--rm", imgName, "echo", "helloworld"}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) Expect(session.OutputToString()).To(ContainSubstring("helloworld")) + Expect(session.ErrorToString()).To(ContainSubstring("The storage 'driver' option should be set in ")) + Expect(session.ErrorToString()).To(ContainSubstring("A driver was picked automatically.")) }) It("podman pull by digest", func() { - session := podmanTest.Podman([]string{"pull", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) + session := podmanTest.Podman([]string{"pull", "-q", "quay.io/libpod/testdigest_v2s2@sha256:755f4d90b3716e2bf57060d249e2cd61c9ac089b1233465c5c2cb2d7ee550fdb"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -145,7 +149,7 @@ var _ = Describe("Podman pull", func() { }) It("podman pull check all tags", func() { - session := podmanTest.Podman([]string{"pull", "--all-tags", "quay.io/libpod/testdigest_v2s2"}) + session := podmanTest.Podman([]string{"pull", "-q", "--all-tags", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -154,7 +158,7 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(ExitCleanly()) Expect(len(session.OutputToStringArray())).To(BeNumerically(">=", 2), "Expected at least two images") - session = podmanTest.Podman([]string{"pull", "-a", "quay.io/libpod/testdigest_v2s2"}) + session = podmanTest.Podman([]string{"pull", "-q", "-a", "quay.io/libpod/testdigest_v2s2"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -165,13 +169,14 @@ var _ = Describe("Podman pull", func() { }) It("podman pull from docker with nonexistent --authfile", func() { - session := podmanTest.Podman([]string{"pull", "--authfile", "/tmp/nonexistent", ALPINE}) + session := podmanTest.Podman([]string{"pull", "-q", "--authfile", "/tmp/nonexistent", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) + Expect(session.ErrorToString()).To(Equal("Error: checking authfile: stat /tmp/nonexistent: no such file or directory")) }) It("podman pull by digest (image list)", func() { - session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINELISTDIGEST}) + session := podmanTest.Podman([]string{"pull", "-q", "--arch=arm64", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) // inspect using the digest of the list @@ -214,7 +219,7 @@ var _ = Describe("Podman pull", func() { }) It("podman pull by instance digest (image list)", func() { - session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINEARM64DIGEST}) + session := podmanTest.Podman([]string{"pull", "-q", "--arch=arm64", ALPINEARM64DIGEST}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) // inspect using the digest of the list @@ -254,7 +259,7 @@ var _ = Describe("Podman pull", func() { }) It("podman pull by tag (image list)", func() { - session := podmanTest.Podman([]string{"pull", "--arch=arm64", ALPINELISTTAG}) + session := podmanTest.Podman([]string{"pull", "-q", "--arch=arm64", ALPINELISTTAG}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) // inspect using the tag we used for pulling @@ -312,14 +317,14 @@ var _ = Describe("Podman pull", func() { podmanTest.AddImageToRWStore(CIRROS_IMAGE) tarfn := filepath.Join(podmanTest.TempDir, "cirros.tar") - session := podmanTest.Podman([]string{"save", "-o", tarfn, "cirros"}) + session := podmanTest.Podman([]string{"save", "-q", "-o", tarfn, "cirros"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:%s", tarfn)}) + session = podmanTest.Podman([]string{"pull", "-q", fmt.Sprintf("docker-archive:%s", tarfn)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) @@ -329,7 +334,7 @@ var _ = Describe("Podman pull", func() { // Pulling a multi-image archive without further specifying // which image _must_ error out. Pulling is restricted to one // image. - session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz"}) + session = podmanTest.Podman([]string{"pull", "-q", "docker-archive:./testdata/docker-two-images.tar.xz"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) expectedError := "Unexpected tar manifest.json: expected 1 item, got 2" @@ -337,30 +342,30 @@ var _ = Describe("Podman pull", func() { // Now pull _one_ image from a multi-image archive via the name // and index syntax. - session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@0"}) + session = podmanTest.Podman([]string{"pull", "-q", "docker-archive:./testdata/docker-two-images.tar.xz:@0"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty:latest"}) + session = podmanTest.Podman([]string{"pull", "-q", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty:latest"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@1"}) + session = podmanTest.Podman([]string{"pull", "-q", "docker-archive:./testdata/docker-two-images.tar.xz:@1"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty/but:different"}) + session = podmanTest.Podman([]string{"pull", "-q", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty/but:different"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) // Now check for some errors. - session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:foo.com/does/not/exist:latest"}) + session = podmanTest.Podman([]string{"pull", "-q", "docker-archive:./testdata/docker-two-images.tar.xz:foo.com/does/not/exist:latest"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) expectedError = "Tag \"foo.com/does/not/exist:latest\" not found" Expect(session.ErrorToString()).To(ContainSubstring(expectedError)) - session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@2"}) + session = podmanTest.Podman([]string{"pull", "-q", "docker-archive:./testdata/docker-two-images.tar.xz:@2"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) expectedError = "Invalid source index @2, only 2 manifest items available" @@ -372,14 +377,14 @@ var _ = Describe("Podman pull", func() { podmanTest.AddImageToRWStore(CIRROS_IMAGE) tarfn := filepath.Join(podmanTest.TempDir, "oci-cirrus.tar") - session := podmanTest.Podman([]string{"save", "--format", "oci-archive", "-o", tarfn, "cirros"}) + session := podmanTest.Podman([]string{"save", "-q", "--format", "oci-archive", "-o", tarfn, "cirros"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"pull", fmt.Sprintf("oci-archive:%s", tarfn)}) + session = podmanTest.Podman([]string{"pull", "-q", fmt.Sprintf("oci-archive:%s", tarfn)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) @@ -396,7 +401,7 @@ var _ = Describe("Podman pull", func() { Expect(err).ToNot(HaveOccurred()) imgPath := fmt.Sprintf("dir:%s", dirpath) - session := podmanTest.Podman([]string{"push", "cirros", imgPath}) + session := podmanTest.Podman([]string{"push", "-q", "cirros", imgPath}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) @@ -404,7 +409,9 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"run", imgPath, "ls"}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) + Expect(session.ErrorToString()).To(ContainSubstring("Copying blob"), "Image is pulled on run") + // Note that reference is not preserved in dir. session = podmanTest.Podman([]string{"image", "exists", "cirros"}) session.WaitWithDefaultTimeout() @@ -421,13 +428,13 @@ var _ = Describe("Podman pull", func() { imgName := "localhost/name:tag" imgPath := fmt.Sprintf("oci:%s:%s", dirpath, imgName) - session := podmanTest.Podman([]string{"push", "cirros", imgPath}) + session := podmanTest.Podman([]string{"push", "-q", "cirros", imgPath}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"rmi", "cirros"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"pull", imgPath}) + session = podmanTest.Podman([]string{"pull", "-q", imgPath}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"image", "exists", imgName}) @@ -535,13 +542,13 @@ var _ = Describe("Podman pull", func() { }) It("podman pull --platform", func() { - session := podmanTest.Podman([]string{"pull", "--platform=linux/bogus", ALPINE}) + session := podmanTest.Podman([]string{"pull", "-q", "--platform=linux/bogus", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) expectedError := "no image found in manifest list for architecture bogus" Expect(session.ErrorToString()).To(ContainSubstring(expectedError)) - session = podmanTest.Podman([]string{"pull", "--platform=linux/arm64", "--os", "windows", ALPINE}) + session = podmanTest.Podman([]string{"pull", "-q", "--platform=linux/arm64", "--os", "windows", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) expectedError = "--platform option can not be specified with --arch or --os" @@ -562,13 +569,13 @@ var _ = Describe("Podman pull", func() { }) It("podman pull --arch", func() { - session := podmanTest.Podman([]string{"pull", "--arch=bogus", ALPINE}) + session := podmanTest.Podman([]string{"pull", "-q", "--arch=bogus", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) expectedError := "no image found in manifest list for architecture bogus" Expect(session.ErrorToString()).To(ContainSubstring(expectedError)) - session = podmanTest.Podman([]string{"pull", "--arch=arm64", "--os", "windows", ALPINE}) + session = podmanTest.Podman([]string{"pull", "-q", "--arch=arm64", "--os", "windows", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) expectedError = "no image found in manifest list for architecture" @@ -591,7 +598,7 @@ var _ = Describe("Podman pull", func() { It("podman pull progress", func() { session := podmanTest.Podman([]string{"pull", ALPINE}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) output := session.ErrorToString() Expect(output).To(ContainSubstring("Getting image source signatures")) Expect(output).To(ContainSubstring("Copying blob ")) @@ -599,7 +606,6 @@ var _ = Describe("Podman pull", func() { session = podmanTest.Podman([]string{"pull", "-q", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - Expect(session.ErrorToString()).To(BeEmpty()) }) Describe("podman pull and decrypt", func() { @@ -614,7 +620,7 @@ var _ = Describe("Podman pull", func() { _, wrongPrivateKeyFileName, err := WriteRSAKeyPair(wrongKeyFileName, bitSize) Expect(err).ToNot(HaveOccurred()) - session := podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, imgPath}) + session := podmanTest.Podman([]string{"push", "-q", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, imgPath}) session.WaitWithDefaultTimeout() session = podmanTest.Podman([]string{"rmi", ALPINE}) @@ -627,12 +633,12 @@ var _ = Describe("Podman pull", func() { Expect(session).Should(Exit(125)) // Pulling encrypted image with wrong key should fail - session = podmanTest.Podman([]string{"pull", "--decryption-key", wrongPrivateKeyFileName, imgPath}) + session = podmanTest.Podman([]string{"pull", "-q", "--decryption-key", wrongPrivateKeyFileName, imgPath}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) // Pulling encrypted image with correct key should pass - session = podmanTest.Podman([]string{"pull", "--decryption-key", privateKeyFileName, imgPath}) + session = podmanTest.Podman([]string{"pull", "-q", "--decryption-key", privateKeyFileName, imgPath}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"images"}) diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index 2971fc51a3..5a8944b7a3 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -22,7 +22,7 @@ var _ = Describe("Podman push", func() { It("podman push to containers/storage", func() { SkipIfRemote("Remote push does not support containers-storage transport") - session := podmanTest.Podman([]string{"push", ALPINE, "containers-storage:busybox:test"}) + session := podmanTest.Podman([]string{"push", "-q", ALPINE, "containers-storage:busybox:test"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -34,13 +34,13 @@ var _ = Describe("Podman push", func() { It("podman push to dir", func() { SkipIfRemote("Remote push does not support dir transport") bbdir := filepath.Join(podmanTest.TempDir, "busybox") - session := podmanTest.Podman([]string{"push", "--remove-signatures", ALPINE, + session := podmanTest.Podman([]string{"push", "-q", "--remove-signatures", ALPINE, fmt.Sprintf("dir:%s", bbdir)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) bbdir = filepath.Join(podmanTest.TempDir, "busybox") - session = podmanTest.Podman([]string{"push", "--format", "oci", ALPINE, + session = podmanTest.Podman([]string{"push", "-q", "--format", "oci", ALPINE, fmt.Sprintf("dir:%s", bbdir)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -51,13 +51,13 @@ var _ = Describe("Podman push", func() { bbdir := filepath.Join(podmanTest.TempDir, "busybox-oci") // Invalid compression format specified, it must fail - session := podmanTest.Podman([]string{"push", "--compression-format=gzip", "--compression-level=40", ALPINE, fmt.Sprintf("oci:%s", bbdir)}) + session := podmanTest.Podman([]string{"push", "-q", "--compression-format=gzip", "--compression-level=40", ALPINE, fmt.Sprintf("oci:%s", bbdir)}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) output := session.ErrorToString() Expect(output).To(ContainSubstring("invalid compression level")) - session = podmanTest.Podman([]string{"push", "--compression-format=zstd", "--remove-signatures", ALPINE, + session = podmanTest.Podman([]string{"push", "-q", "--compression-format=zstd", "--remove-signatures", ALPINE, fmt.Sprintf("oci:%s", bbdir)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -106,37 +106,38 @@ var _ = Describe("Podman push", func() { session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", "imageone", "localhost:5000/image"}) + push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", "imageone", "localhost:5000/image"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", "quay.io/skopeo/stable", "inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/image:latest"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - output := session.OutputToString() + skopeoInspect := []string{"inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/image:latest"} + skopeo := SystemExec("skopeo", skopeoInspect) + skopeo.WaitWithDefaultTimeout() + Expect(skopeo).Should(ExitCleanly()) + output := skopeo.OutputToString() // Default compression is gzip and push with `--force-compression=false` no traces of `zstd` should be there. Expect(output).ToNot(ContainSubstring("zstd")) - push = podmanTest.Podman([]string{"push", "--tls-verify=false", "--force-compression=false", "--compression-format", "zstd", "--remove-signatures", "imageone", "localhost:5000/image"}) + push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--force-compression=false", "--compression-format", "zstd", "--remove-signatures", "imageone", "localhost:5000/image"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", "quay.io/skopeo/stable", "inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/image:latest"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - output = session.OutputToString() + skopeo = SystemExec("skopeo", skopeoInspect) + skopeo.WaitWithDefaultTimeout() + Expect(skopeo).Should(ExitCleanly()) + output = skopeo.OutputToString() // Although `--compression-format` is `zstd` but still no traces of `zstd` should be in image // since blobs must be reused from last `gzip` image. Expect(output).ToNot(ContainSubstring("zstd")) - push = podmanTest.Podman([]string{"push", "--tls-verify=false", "--compression-format", "zstd", "--force-compression", "--remove-signatures", "imageone", "localhost:5000/image"}) + push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--compression-format", "zstd", "--force-compression", "--remove-signatures", "imageone", "localhost:5000/image"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", "quay.io/skopeo/stable", "inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/image:latest"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - output = session.OutputToString() + skopeo = SystemExec("skopeo", skopeoInspect) + skopeo.WaitWithDefaultTimeout() + Expect(skopeo).Should(ExitCleanly()) + output = skopeo.OutputToString() // Should contain `zstd` layer, substring `zstd` is enough to confirm in skopeo inspect output that `zstd` layer is present. Expect(output).To(ContainSubstring("zstd")) }) @@ -162,11 +163,10 @@ var _ = Describe("Podman push", func() { push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - Expect(push.ErrorToString()).To(BeEmpty()) push = podmanTest.Podman([]string{"push", "--compression-format=gzip", "--compression-level=1", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) push.WaitWithDefaultTimeout() - Expect(push).Should(ExitCleanly()) + Expect(push).Should(Exit(0)) output := push.ErrorToString() Expect(output).To(ContainSubstring("Copying blob ")) Expect(output).To(ContainSubstring("Copying config ")) @@ -178,14 +178,14 @@ var _ = Describe("Podman push", func() { Expect(err).ToNot(HaveOccurred()) if !IsRemote() { // Remote does not support --encryption-key - push = podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) + push = podmanTest.Podman([]string{"push", "-q", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) } // Test --digestfile option digestFile := filepath.Join(podmanTest.TempDir, "digestfile.txt") - push2 := podmanTest.Podman([]string{"push", "--tls-verify=false", "--digestfile=" + digestFile, "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) + push2 := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--digestfile=" + digestFile, "--remove-signatures", ALPINE, "localhost:5000/my-alpine"}) push2.WaitWithDefaultTimeout() fi, err := os.Lstat(digestFile) Expect(err).ToNot(HaveOccurred()) @@ -215,7 +215,6 @@ var _ = Describe("Podman push", func() { push := podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/sigstore-signed"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - Expect(push.ErrorToString()).To(BeEmpty()) pull := podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed"}) pull.WaitWithDefaultTimeout() @@ -226,7 +225,6 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", "--sign-by-sigstore-private-key", "testdata/sigstore-key.key", "--sign-passphrase-file", "testdata/sigstore-key.key.pass", ALPINE, "localhost:5000/sigstore-signed"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - Expect(push.ErrorToString()).To(BeEmpty()) pull = podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed"}) pull.WaitWithDefaultTimeout() @@ -237,9 +235,8 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/sigstore-signed-params"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - Expect(push.ErrorToString()).To(BeEmpty()) - pull = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed-params"}) + pull = podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed-params"}) pull.WaitWithDefaultTimeout() Expect(pull).To(ExitWithError()) Expect(pull.ErrorToString()).To(ContainSubstring("A signature was required, but no signature exists")) @@ -248,9 +245,8 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--remove-signatures", "--sign-by-sigstore", "testdata/sigstore-signing-params.yaml", ALPINE, "localhost:5000/sigstore-signed-params"}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - Expect(push.ErrorToString()).To(BeEmpty()) - pull = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed-params"}) + pull = podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/sigstore-signed-params"}) pull.WaitWithDefaultTimeout() Expect(pull).Should(ExitCleanly()) } @@ -266,10 +262,10 @@ var _ = Describe("Podman push", func() { Expect(inspect).Should(ExitCleanly()) imageID := inspect.OutputToString() + // FIXME FIXME push := podmanTest.Podman([]string{"push", "--signature-policy", denyAllPolicy, "-q", imageID, "dir:" + filepath.Join(podmanTest.TempDir, imageID)}) push.WaitWithDefaultTimeout() Expect(push).Should(ExitCleanly()) - Expect(push.ErrorToString()).To(BeEmpty()) }) It("podman push to local registry with authorization", func() { @@ -303,19 +299,14 @@ var _ = Describe("Podman push", func() { Expect(err).ToNot(HaveOccurred()) session := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v", - strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e", + strings.Join([]string{authPath, "/auth", "z"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e", "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm", "-e", "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd", - "-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt", + "-v", strings.Join([]string{certPath, "/certs", "z"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt", "-e", "REGISTRY_HTTP_TLS_KEY=/certs/domain.key", REGISTRY_IMAGE}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) { - Skip("Cannot start docker registry.") - } - - session = podmanTest.Podman([]string{"logs", "registry"}) - session.WaitWithDefaultTimeout() + Expect(WaitContainerReady(podmanTest, "registry", "listening on", 20, 1)).To(BeTrue(), "registry container ready") push := podmanTest.Podman([]string{"push", "--tls-verify=true", "--format=v2s2", "--creds=podmantest:test", ALPINE, "localhost:5000/tlstest"}) push.WaitWithDefaultTimeout() @@ -324,7 +315,7 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", "--tls-verify=false", ALPINE, "localhost:5000/tlstest"}) push.WaitWithDefaultTimeout() - Expect(push).Should(ExitCleanly()) + Expect(push).Should(Exit(0)) Expect(push.ErrorToString()).To(ContainSubstring("Writing manifest to image destination")) setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"}) @@ -345,7 +336,7 @@ var _ = Describe("Podman push", func() { push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/defaultflags"}) push.WaitWithDefaultTimeout() - Expect(push).Should(ExitCleanly()) + Expect(push).Should(Exit(0)) Expect(push.ErrorToString()).To(ContainSubstring("Writing manifest to image destination")) // create and push manifest @@ -355,7 +346,7 @@ var _ = Describe("Podman push", func() { session = podmanTest.Podman([]string{"manifest", "push", "--creds=podmantest:test", "--tls-verify=false", "--all", "localhost:5000/manifesttest"}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) + Expect(session).Should(Exit(0)) Expect(session.ErrorToString()).To(ContainSubstring("Writing manifest list to image destination")) }) @@ -369,7 +360,7 @@ var _ = Describe("Podman push", func() { publicKeyFileName, _, err := WriteRSAKeyPair(keyFileName, bitSize) Expect(err).ToNot(HaveOccurred()) - session := podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, ALPINE, fmt.Sprintf("oci:%s", bbdir)}) + session := podmanTest.Podman([]string{"push", "-q", "--encryption-key", "jwe:" + publicKeyFileName, ALPINE, fmt.Sprintf("oci:%s", bbdir)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -381,7 +372,7 @@ var _ = Describe("Podman push", func() { It("podman push to docker-archive", func() { SkipIfRemote("Remote push does not support docker-archive transport") tarfn := filepath.Join(podmanTest.TempDir, "alp.tar") - session := podmanTest.Podman([]string{"push", ALPINE, + session := podmanTest.Podman([]string{"push", "-q", ALPINE, fmt.Sprintf("docker-archive:%s:latest", tarfn)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -397,13 +388,13 @@ var _ = Describe("Podman push", func() { Expect(setup).Should(ExitCleanly()) defer func() { stop := SystemExec("systemctl", []string{"stop", "docker"}) - Expect(stop).Should(ExitCleanly()) + Expect(stop).Should(Exit(0)) }() } else if setup.ExitCode() != 0 { Skip("Docker is not available") } - session := podmanTest.Podman([]string{"push", ALPINE, "docker-daemon:alpine:podmantest"}) + session := podmanTest.Podman([]string{"push", "-q", ALPINE, "docker-daemon:alpine:podmantest"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -418,7 +409,7 @@ var _ = Describe("Podman push", func() { It("podman push to oci-archive", func() { SkipIfRemote("Remote push does not support oci-archive transport") tarfn := filepath.Join(podmanTest.TempDir, "alp.tar") - session := podmanTest.Podman([]string{"push", ALPINE, + session := podmanTest.Podman([]string{"push", "-q", ALPINE, fmt.Sprintf("oci-archive:%s:latest", tarfn)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -427,7 +418,7 @@ var _ = Describe("Podman push", func() { It("podman push to docker-archive no reference", func() { SkipIfRemote("Remote push does not support docker-archive transport") tarfn := filepath.Join(podmanTest.TempDir, "alp.tar") - session := podmanTest.Podman([]string{"push", ALPINE, + session := podmanTest.Podman([]string{"push", "-q", ALPINE, fmt.Sprintf("docker-archive:%s", tarfn)}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -436,7 +427,7 @@ var _ = Describe("Podman push", func() { It("podman push to oci-archive no reference", func() { SkipIfRemote("Remote push does not support oci-archive transport") ociarc := filepath.Join(podmanTest.TempDir, "alp-oci") - session := podmanTest.Podman([]string{"push", ALPINE, + session := podmanTest.Podman([]string{"push", "-q", ALPINE, fmt.Sprintf("oci-archive:%s", ociarc)}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go index 4fbdb8aa85..7cbff7bb23 100644 --- a/test/e2e/save_test.go +++ b/test/e2e/save_test.go @@ -17,7 +17,7 @@ var _ = Describe("Podman save", func() { It("podman save output flag", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) }) @@ -26,7 +26,7 @@ var _ = Describe("Podman save", func() { SkipIfRemote("--signature-policy N/A for remote") outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "--signature-policy", "/etc/containers/policy.json", "-o", outfile, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "--signature-policy", "/etc/containers/policy.json", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) }) @@ -34,7 +34,7 @@ var _ = Describe("Podman save", func() { It("podman save oci flag", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) }) @@ -59,7 +59,7 @@ var _ = Describe("Podman save", func() { It("podman save bogus image", func() { outfile := filepath.Join(podmanTest.TempDir, "alpine.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, "FOOBAR"}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, "FOOBAR"}) save.WaitWithDefaultTimeout() Expect(save).To(ExitWithError()) }) @@ -67,7 +67,7 @@ var _ = Describe("Podman save", func() { It("podman save to directory with oci format", func() { outdir := filepath.Join(podmanTest.TempDir, "save") - save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "--format", "oci-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -80,7 +80,7 @@ var _ = Describe("Podman save", func() { It("podman save to directory with v2s2 docker format", func() { outdir := filepath.Join(podmanTest.TempDir, "save") - save := podmanTest.Podman([]string{"save", "--format", "docker-dir", "-o", outdir, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "--format", "docker-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) @@ -91,7 +91,7 @@ var _ = Describe("Podman save", func() { It("podman save to directory with docker format and compression", func() { outdir := filepath.Join(podmanTest.TempDir, "save") - save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) }) @@ -99,12 +99,12 @@ var _ = Describe("Podman save", func() { It("podman save to directory with --compress but not use docker-dir and oci-dir", func() { outdir := filepath.Join(podmanTest.TempDir, "save") - save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-archive", "-o", outdir, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "--compress", "--format", "docker-archive", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() // should not be 0 Expect(save).To(ExitWithError()) - save = podmanTest.Podman([]string{"save", "--compress", "--format", "oci-archive", "-o", outdir, ALPINE}) + save = podmanTest.Podman([]string{"save", "-q", "--compress", "--format", "oci-archive", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() // should not be 0 Expect(save).To(ExitWithError()) @@ -114,7 +114,7 @@ var _ = Describe("Podman save", func() { It("podman save bad filename", func() { outdir := filepath.Join(podmanTest.TempDir, "save:colon") - save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE}) + save := podmanTest.Podman([]string{"save", "-q", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE}) save.WaitWithDefaultTimeout() Expect(save).To(ExitWithError()) }) @@ -177,7 +177,7 @@ default-docker: session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"push", "--tls-verify=false", "--sign-by", "foo@bar.com", "localhost:5000/alpine"}) + session = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--sign-by", "foo@bar.com", "localhost:5000/alpine"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -190,12 +190,12 @@ default-docker: policyPath := generatePolicyFile(podmanTest.TempDir) defer os.Remove(policyPath) - session = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/alpine"}) + session = podmanTest.Podman([]string{"pull", "-q", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/alpine"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) outfile := filepath.Join(podmanTest.TempDir, "temp.tar") - save := podmanTest.Podman([]string{"save", "remove-signatures=true", "-o", outfile, "localhost:5000/alpine"}) + save := podmanTest.Podman([]string{"save", "-q", "remove-signatures=true", "-o", outfile, "localhost:5000/alpine"}) save.WaitWithDefaultTimeout() Expect(save).To(ExitWithError()) } @@ -203,13 +203,13 @@ default-docker: It("podman save image with digest reference", func() { // pull a digest reference - session := podmanTest.Podman([]string{"pull", ALPINELISTDIGEST}) + session := podmanTest.Podman([]string{"pull", "-q", ALPINELISTDIGEST}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) // save a digest reference should exit without error. outfile := filepath.Join(podmanTest.TempDir, "temp.tar") - save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINELISTDIGEST}) + save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINELISTDIGEST}) save.WaitWithDefaultTimeout() Expect(save).Should(ExitCleanly()) }) @@ -239,7 +239,7 @@ default-docker: func multiImageSave(podmanTest *PodmanTestIntegration, images []string) { // Create the archive. outfile := filepath.Join(podmanTest.TempDir, "temp.tar") - session := podmanTest.Podman(append([]string{"save", "-o", outfile, "--multi-image-archive"}, images...)) + session := podmanTest.Podman(append([]string{"save", "-q", "-o", outfile, "--multi-image-archive"}, images...)) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -249,7 +249,7 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) { Expect(session).Should(ExitCleanly()) // Now load the archive. - session = podmanTest.Podman([]string{"load", "-i", outfile}) + session = podmanTest.Podman([]string{"load", "-q", "-i", outfile}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) // Grep for each image in the `podman load` output.