ExitWithError() - more run_xxx tests

Followup to #22270: wherever possible/practical, extend command
error checks to include explicit exit status codes and error strings.

This commit handles a subset of test/e2e/run_xxx_test.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2024-05-02 11:18:22 -06:00
parent 0c09421f85
commit 03f036b515
8 changed files with 31 additions and 22 deletions

View File

@ -98,7 +98,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
skipIfAppArmorDisabled()
session := podmanTest.Podman([]string{"run", "--security-opt", "apparmor=invalid", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
Expect(session).To(ExitWithError(126, `AppArmor profile "invalid" specified but not loaded`))
})
It("podman run apparmor unconfined", func() {
@ -118,7 +118,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
// Should fail if user specifies apparmor on disabled system
session := podmanTest.Podman([]string{"create", "--security-opt", fmt.Sprintf("apparmor=%s", apparmor.Profile), ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
Expect(session).To(ExitWithError(125, fmt.Sprintf(`apparmor profile "%s" specified, but Apparmor is not enabled on this system`, apparmor.Profile)))
})
It("podman run apparmor disabled no default", func() {