test: adapt tests new crun error messages

Needed-by: https://github.com/containers/crun/pull/1672

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2025-02-17 09:12:31 +01:00
parent 35d2a65e3a
commit c65bb903b6
6 changed files with 39 additions and 18 deletions

View File

@ -421,19 +421,20 @@ var _ = Describe("Podman exec", func() {
session := podmanTest.Podman([]string{"exec", "test1", "/etc"})
session.WaitWithDefaultTimeout()
// crun (and, we hope, any other future runtimes)
expectedStatus := 126
expectedMessage := "open executable: Operation not permitted: OCI permission denied"
// ...but it's much more complicated under runc (#19552)
if podmanTest.OCIRuntime == "runc" {
expectedMessage = `exec failed: unable to start container process: exec: "/etc": is a directory`
expectedStatus = 255
expectedMessage := `exec failed: unable to start container process: exec: "/etc": is a directory`
expectedStatus := 255
if IsRemote() {
expectedStatus = 125
}
Expect(session).Should(ExitWithError(expectedStatus, expectedMessage))
} else {
// crun (and, we hope, any other future runtimes)
expectedStatus := 126
expectedMessage := ".*(open executable|the path `/etc` is not a regular file): Operation not permitted: OCI permission denied.*"
Expect(session).Should(ExitWithErrorRegex(expectedStatus, expectedMessage))
}
Expect(session).Should(ExitWithError(expectedStatus, expectedMessage))
})
It("podman exec command not found", func() {