mirror of
https://github.com/containers/podman.git
synced 2025-08-01 07:40:22 +08:00

Commit 1 of 2. More easy ones: test files that either work with ExitCleanly() or require very, very simple tweaks. Signed-off-by: Ed Santiago <santiago@redhat.com>
51 lines
1.5 KiB
Go
51 lines
1.5 KiB
Go
package integration
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/containers/podman/v4/libpod/define"
|
|
. "github.com/containers/podman/v4/test/utils"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
. "github.com/onsi/gomega/gexec"
|
|
)
|
|
|
|
var _ = Describe("Podman run exit", func() {
|
|
|
|
It("podman run exit define.ExecErrorCodeGeneric", func() {
|
|
result := podmanTest.Podman([]string{"run", "--foobar", ALPINE, "ls", "$tmp"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(Exit(define.ExecErrorCodeGeneric))
|
|
})
|
|
|
|
It("podman run exit ExecErrorCodeCannotInvoke", func() {
|
|
result := podmanTest.Podman([]string{"run", ALPINE, "/etc"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(Exit(define.ExecErrorCodeCannotInvoke))
|
|
})
|
|
|
|
It("podman run exit ExecErrorCodeNotFound", func() {
|
|
result := podmanTest.Podman([]string{"run", ALPINE, "foobar"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(Exit(define.ExecErrorCodeNotFound))
|
|
})
|
|
|
|
It("podman run exit 0", func() {
|
|
result := podmanTest.Podman([]string{"run", ALPINE, "ls"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
})
|
|
|
|
It("podman run exit 50", func() {
|
|
result := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", "exit 50"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(Exit(50))
|
|
})
|
|
|
|
It("podman run exit 125", func() {
|
|
result := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", fmt.Sprintf("exit %d", define.ExecErrorCodeGeneric)})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(Exit(define.ExecErrorCodeGeneric))
|
|
})
|
|
})
|