mirror of
https://github.com/containers/podman.git
synced 2025-06-17 15:08:08 +08:00

Automated for .go files via gomove [1]: `gomove github.com/containers/podman/v3 github.com/containers/podman/v4` Remaining files via vgrep [2]: `vgrep github.com/containers/podman/v3` [1] https://github.com/KSubedi/gomove [2] https://github.com/vrothberg/vgrep Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
74 lines
1.9 KiB
Go
74 lines
1.9 KiB
Go
package integration
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/containers/podman/v4/libpod/define"
|
|
. "github.com/containers/podman/v4/test/utils"
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/gomega"
|
|
. "github.com/onsi/gomega/gexec"
|
|
)
|
|
|
|
var _ = Describe("Podman run exit", func() {
|
|
var (
|
|
tempdir string
|
|
err error
|
|
podmanTest *PodmanTestIntegration
|
|
)
|
|
|
|
BeforeEach(func() {
|
|
tempdir, err = CreateTempDirInTempDir()
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
podmanTest = PodmanTestCreate(tempdir)
|
|
podmanTest.Setup()
|
|
podmanTest.SeedImages()
|
|
})
|
|
|
|
AfterEach(func() {
|
|
podmanTest.Cleanup()
|
|
f := CurrentGinkgoTestDescription()
|
|
processTestResult(f)
|
|
|
|
})
|
|
|
|
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(Exit(0))
|
|
})
|
|
|
|
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))
|
|
})
|
|
})
|