mirror of
https://github.com/containers/podman.git
synced 2025-06-30 15:49:03 +08:00
ExitWithError() - a few that I missed
Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -370,8 +370,16 @@ var _ = Describe("Podman checkpoint", func() {
|
|||||||
result = podmanTest.Podman([]string{"container", "restore", cid})
|
result = podmanTest.Podman([]string{"container", "restore", cid})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
|
|
||||||
// FIXME: CRIU failure message not seen by podman (same as above)
|
// default message when using crun
|
||||||
Expect(result).Should(ExitWithError(125))
|
expectStderr := "crun: CRIU restoring failed -52. Please check CRIU logfile"
|
||||||
|
if podmanTest.OCIRuntime == "runc" {
|
||||||
|
expectStderr = "runc: criu failed: type NOTIFY errno 0"
|
||||||
|
}
|
||||||
|
if !IsRemote() {
|
||||||
|
// This part is only seen with podman local, never remote
|
||||||
|
expectStderr = "OCI runtime error: " + expectStderr
|
||||||
|
}
|
||||||
|
Expect(result).Should(ExitWithError(125, expectStderr))
|
||||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||||
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
|
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ var _ = Describe("Podman run device", func() {
|
|||||||
It("podman run bad device test", func() {
|
It("podman run bad device test", func() {
|
||||||
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/baddevice", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/baddevice", ALPINE, "true"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(ExitWithError())
|
Expect(session).To(ExitWithError(125, "stat /dev/baddevice: no such file or directory"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run device test", func() {
|
It("podman run device test", func() {
|
||||||
|
@ -82,6 +82,7 @@ var _ = Describe("Podman run with --ip flag", func() {
|
|||||||
result := podmanTest.Podman([]string{"run", "-d", "--name", "nginx", "--ip", ip, NGINX_IMAGE})
|
result := podmanTest.Podman([]string{"run", "-d", "--name", "nginx", "--ip", ip, NGINX_IMAGE})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(ExitCleanly())
|
Expect(result).Should(ExitCleanly())
|
||||||
|
cid := result.OutputToString()
|
||||||
|
|
||||||
// This test should not use a proxy
|
// This test should not use a proxy
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
@ -112,7 +113,6 @@ var _ = Describe("Podman run with --ip flag", func() {
|
|||||||
}
|
}
|
||||||
result = podmanTest.Podman([]string{"run", "--ip", ip, ALPINE, "ip", "addr"})
|
result = podmanTest.Podman([]string{"run", "--ip", ip, ALPINE, "ip", "addr"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).To(ExitWithError())
|
Expect(result).To(ExitWithError(126, fmt.Sprintf("IPAM error: requested ip address %s is already allocated to container ID %s", ip, cid)))
|
||||||
Expect(result.ErrorToString()).To(ContainSubstring(" address %s ", ip))
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -64,17 +64,20 @@ var _ = Describe("podman container runlabel", func() {
|
|||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(ExitCleanly())
|
Expect(result).Should(ExitCleanly())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman container runlabel bogus label should result in non-zero exit code", func() {
|
It("podman container runlabel bogus label should result in non-zero exit code", func() {
|
||||||
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", ALPINE})
|
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", ALPINE})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).To(ExitWithError())
|
Expect(result).To(ExitWithError(125, fmt.Sprintf("cannot find the value of label: RUN in image: %s", ALPINE)))
|
||||||
// should not panic when label missing the value or don't have the label
|
// should not panic when label missing the value or don't have the label
|
||||||
Expect(result.OutputToString()).To(Not(ContainSubstring("panic")))
|
Expect(result.OutputToString()).To(Not(ContainSubstring("panic")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman container runlabel bogus label in remote image should result in non-zero exit", func() {
|
It("podman container runlabel bogus label in remote image should result in non-zero exit", func() {
|
||||||
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", "docker.io/library/ubuntu:latest"})
|
remoteImage := "quay.io/libpod/testimage:00000000"
|
||||||
|
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", remoteImage})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).To(ExitWithError())
|
Expect(result).To(ExitWithError(125, fmt.Sprintf("cannot find the value of label: RUN in image: %s", remoteImage)))
|
||||||
// should not panic when label missing the value or don't have the label
|
// should not panic when label missing the value or don't have the label
|
||||||
Expect(result.OutputToString()).To(Not(ContainSubstring("panic")))
|
Expect(result.OutputToString()).To(Not(ContainSubstring("panic")))
|
||||||
})
|
})
|
||||||
@ -86,7 +89,7 @@ var _ = Describe("podman container runlabel", func() {
|
|||||||
// runlabel should fail with nonexistent authfile
|
// runlabel should fail with nonexistent authfile
|
||||||
result := podmanTest.Podman([]string{"container", "runlabel", "--authfile", "/tmp/nonexistent", "RUN", image})
|
result := podmanTest.Podman([]string{"container", "runlabel", "--authfile", "/tmp/nonexistent", "RUN", image})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).To(ExitWithError())
|
Expect(result).To(ExitWithError(125, "credential file is not accessible: faccessat /tmp/nonexistent: no such file or directory"))
|
||||||
|
|
||||||
result = podmanTest.Podman([]string{"rmi", image})
|
result = podmanTest.Podman([]string{"rmi", image})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
|
Reference in New Issue
Block a user