From 5dc1738c0566cffc8925300557fbeb33ddac5b4f Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 29 May 2024 22:02:43 +0200 Subject: [PATCH] test: look at the file base name make the test more robust when an absolute path is used. Signed-off-by: Giuseppe Scrivano --- test/e2e/run_seccomp_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/run_seccomp_test.go b/test/e2e/run_seccomp_test.go index 21387d6cb0..fd28ff7182 100644 --- a/test/e2e/run_seccomp_test.go +++ b/test/e2e/run_seccomp_test.go @@ -2,6 +2,7 @@ package integration import ( "fmt" + "path/filepath" . "github.com/containers/podman/v5/test/utils" . "github.com/onsi/ginkgo/v2" @@ -35,17 +36,20 @@ var _ = Describe("Podman run", func() { // TODO: we're getting a "cannot start a container that has // stopped" error which seems surprising. Investigate // why that is so. - if podmanTest.OCIRuntime == "runc" { + base := filepath.Base(podmanTest.OCIRuntime) + if base == "runc" { // TODO: worse than that. With runc, we get two alternating failures: // 126 + cannot start a container that has stopped // 127 + failed to connect to container's attach socket ... ENOENT Expect(session.ExitCode()).To(BeNumerically(">=", 126), "Exit status using runc") - } else { + } else if base == "crun" { expect := fmt.Sprintf("OCI runtime error: %s: read from the init process", podmanTest.OCIRuntime) if IsRemote() { expect = fmt.Sprintf("for attach: %s: read from the init process: OCI runtime error", podmanTest.OCIRuntime) } Expect(session).To(ExitWithError(126, expect)) + } else { + Skip("Not valid with the current OCI runtime") } })