6
"github.com/containers/podman/v5/libpod/define"
7
. "github.com/containers/podman/v5/test/utils"
8
. "github.com/onsi/ginkgo/v2"
9
. "github.com/onsi/gomega"
10
. "github.com/onsi/gomega/gexec"
13
var _ = Describe("Podman run exit", func() {
15
It("podman run exit define.ExecErrorCodeGeneric", func() {
16
result := podmanTest.Podman([]string{"run", "--foobar", ALPINE, "ls", "$tmp"})
17
result.WaitWithDefaultTimeout()
18
Expect(result).Should(Exit(define.ExecErrorCodeGeneric))
21
It("podman run exit ExecErrorCodeCannotInvoke", func() {
22
result := podmanTest.Podman([]string{"run", ALPINE, "/etc"})
23
result.WaitWithDefaultTimeout()
24
Expect(result).Should(Exit(define.ExecErrorCodeCannotInvoke))
27
It("podman run exit ExecErrorCodeNotFound", func() {
28
result := podmanTest.Podman([]string{"run", ALPINE, "foobar"})
29
result.WaitWithDefaultTimeout()
30
Expect(result).Should(Exit(define.ExecErrorCodeNotFound))
33
It("podman run exit 0", func() {
34
result := podmanTest.Podman([]string{"run", ALPINE, "ls"})
35
result.WaitWithDefaultTimeout()
36
Expect(result).Should(ExitCleanly())
39
It("podman run exit 50", func() {
40
result := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", "exit 50"})
41
result.WaitWithDefaultTimeout()
42
Expect(result).Should(Exit(50))
45
It("podman run exit 125", func() {
46
result := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", fmt.Sprintf("exit %d", define.ExecErrorCodeGeneric)})
47
result.WaitWithDefaultTimeout()
48
Expect(result).Should(Exit(define.ExecErrorCodeGeneric))