Skip to content

Commit 1e70e14

Browse files
committed
Fix test assertions to use ExitWithError matcher
Signed-off-by: MayorFaj <[email protected]>
1 parent ed3c92d commit 1e70e14

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

test/e2e/artifact_mount_test.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,13 @@ var _ = Describe("Podman artifact mount", func() {
257257
}
258258
session := podmanTest.Podman(cmd)
259259
session.WaitWithDefaultTimeout()
260-
Expect(session).Should(Exit(125))
261-
// Verify error comes from our validation code
262-
Expect(session.ErrorToString()).To(SatisfyAll(
263-
ContainSubstring("validating artifact"),
264-
ContainSubstring("nonexistent-artifact"),
265-
))
260+
Expect(session).To(ExitWithError(125, "validating artifact"))
261+
Expect(session.ErrorToString()).To(ContainSubstring("nonexistent-artifact"))
266262

267263
// Ensure container was not created
268264
rmSession := podmanTest.Podman([]string{"rm", "test-nonexistent"})
269265
rmSession.WaitWithDefaultTimeout()
270-
Expect(rmSession).Should(Exit(1))
271-
Expect(rmSession.ErrorToString()).To(ContainSubstring("no such container"))
266+
Expect(rmSession).To(ExitWithError(1, "no such container"))
272267
})
273268

274269
It("podman run should fail with non-existent artifact", func() {
@@ -282,17 +277,13 @@ var _ = Describe("Podman artifact mount", func() {
282277
}
283278
session := podmanTest.Podman(cmd)
284279
session.WaitWithDefaultTimeout()
285-
Expect(session).Should(Exit(125))
286-
// Verify error comes from our validation code
287-
Expect(session.ErrorToString()).To(SatisfyAll(
288-
ContainSubstring("validating artifact"),
289-
ContainSubstring("invalid-artifact-ref"),
290-
))
280+
Expect(session).To(ExitWithError(125, "validating artifact"))
281+
Expect(session.ErrorToString()).To(ContainSubstring("invalid-artifact-ref"))
291282

292283
// Ensure container was not created
293284
psSession := podmanTest.Podman([]string{"ps", "-a", "--filter", "name=test-run-nonexistent"})
294285
psSession.WaitWithDefaultTimeout()
295-
Expect(psSession).Should(Exit(0))
286+
Expect(psSession).Should(ExitCleanly())
296287
Expect(psSession.OutputToString()).ToNot(ContainSubstring("test-run-nonexistent"))
297288
})
298289
})

0 commit comments

Comments
 (0)