mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
podman pod exists
like containers and images, users would benefit from being able to check if a pod exists in local storage. if the pod exists, the return code is 0. if the pod does not exists, the return code is 1. Any other return code indicates a real errors, such as permissions or runtime. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -82,4 +82,36 @@ var _ = Describe("Podman image|container exists", func() {
|
||||
Expect(session.ExitCode()).To(Equal(1))
|
||||
})
|
||||
|
||||
It("podman pod exists in local storage by name", func() {
|
||||
setup, rc, _ := podmanTest.CreatePod("foobar")
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(rc).To(Equal(0))
|
||||
|
||||
session := podmanTest.Podman([]string{"pod", "exists", "foobar"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
It("podman pod exists in local storage by container ID", func() {
|
||||
setup, rc, podID := podmanTest.CreatePod("")
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(rc).To(Equal(0))
|
||||
|
||||
session := podmanTest.Podman([]string{"pod", "exists", podID})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
It("podman pod exists in local storage by short container ID", func() {
|
||||
setup, rc, podID := podmanTest.CreatePod("")
|
||||
setup.WaitWithDefaultTimeout()
|
||||
Expect(rc).To(Equal(0))
|
||||
|
||||
session := podmanTest.Podman([]string{"pod", "exists", podID[0:12]})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
It("podman pod does not exist in local storage", func() {
|
||||
session := podmanTest.Podman([]string{"pod", "exists", "foobar"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(1))
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user