Skip to content

Commit

Permalink
Update expected errors when pulling encrypted images
Browse files Browse the repository at this point in the history
containers/image#2646 will track actually
returning a meaningful error instead of these internal details.

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Dec 12, 2024
1 parent dc17a5f commit e8de55a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/e2e/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit e8de55a

Please sign in to comment.