From e8de55a2dabf0ba085b6d872f26b8f2925740dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 28 Nov 2024 23:25:42 +0100 Subject: [PATCH] Update expected errors when pulling encrypted images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/containers/image/issues/2646 will track actually returning a meaningful error instead of these internal details. Signed-off-by: Miloslav Trmač --- test/e2e/pull_test.go | 3 ++- test/e2e/run_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index ccc508df42..34930c03ce 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -624,7 +624,8 @@ var _ = Describe("Podman pull", func() { // Pulling encrypted image without key should fail session = podmanTest.Podman([]string{"pull", "--tls-verify=false", imgPath}) session.WaitWithDefaultTimeout() - Expect(session).Should(ExitWithError(125, "invalid tar header")) + Expect(session).Should(ExitWithError(125, " ")) // " ", not "" - stderr can be not empty, and we will match actual contents below. + Expect(session.ErrorToString()).To(Or(ContainSubstring("invalid tar header"), ContainSubstring("does not match config's DiffID"))) // Pulling encrypted image with wrong key should fail session = podmanTest.Podman([]string{"pull", "-q", "--decryption-key", wrongPrivateKeyFileName, "--tls-verify=false", imgPath}) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index ee7147feaf..149449c82d 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -2325,7 +2325,7 @@ WORKDIR /madethis`, BB) session = podmanTest.Podman([]string{"run", "--tls-verify=false", imgPath}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitWithError(125, "Trying to pull "+imgPath)) - Expect(session.ErrorToString()).To(ContainSubstring("invalid tar header")) + Expect(session.ErrorToString()).To(Or(ContainSubstring("invalid tar header"), ContainSubstring("does not match config's DiffID"))) // With session = podmanTest.Podman([]string{"run", "--tls-verify=false", "--decryption-key", privateKeyFileName, imgPath})