diff options
author | Qi Wang <qiwan@redhat.com> | 2019-11-04 15:07:24 -0500 |
---|---|---|
committer | Qi Wang <qiwan@redhat.com> | 2019-11-26 13:19:31 -0500 |
commit | d9400cced2afad61eafa18da661891a96db1eafc (patch) | |
tree | 6672d5b506ac9355eabdca1804dc62060ac91867 /test/e2e/pod_prune_test.go | |
parent | f5ef3d59bcc7e7beae8716ab10153e1eafd634c1 (diff) | |
download | podman-d9400cced2afad61eafa18da661891a96db1eafc.tar.gz podman-d9400cced2afad61eafa18da661891a96db1eafc.tar.bz2 podman-d9400cced2afad61eafa18da661891a96db1eafc.zip |
Remove containers when pruning a stopped pod.
This path allows pod prune & pod rm to remove stopped containers in the pod before deleting the pod.
PrunePods and RemovePod should be able to remove containers without force removal of stopped pods.
Signed-off-by: Qi Wang <qiwan@redhat.com>
Diffstat (limited to 'test/e2e/pod_prune_test.go')
-rw-r--r-- | test/e2e/pod_prune_test.go | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go index da0d425cb..389d3cb27 100644 --- a/test/e2e/pod_prune_test.go +++ b/test/e2e/pod_prune_test.go @@ -41,7 +41,24 @@ var _ = Describe("Podman pod prune", func() { Expect(result.ExitCode()).To(Equal(0)) }) - It("podman pod prune doesn't remove a pod with a container", func() { + It("podman pod prune doesn't remove a pod with a running container", func() { + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) + + ec2 := podmanTest.RunTopContainerInPod("", podid) + ec2.WaitWithDefaultTimeout() + Expect(ec2.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"pod", "prune"}) + result.WaitWithDefaultTimeout() + Expect(result.ExitCode()).To((Equal(0))) + + result = podmanTest.Podman([]string{"ps", "-qa"}) + result.WaitWithDefaultTimeout() + Expect(len(result.OutputToStringArray())).To(Equal(1)) + }) + + It("podman pod prune removes a pod with a stopped container", func() { _, ec, podid := podmanTest.CreatePod("") Expect(ec).To(Equal(0)) @@ -50,11 +67,11 @@ var _ = Describe("Podman pod prune", func() { result := podmanTest.Podman([]string{"pod", "prune"}) result.WaitWithDefaultTimeout() - Expect(result.ExitCode()).To(Equal(125)) + Expect(result.ExitCode()).To(Equal(0)) result = podmanTest.Podman([]string{"ps", "-qa"}) result.WaitWithDefaultTimeout() - Expect(len(result.OutputToStringArray())).To(Equal(1)) + Expect(len(result.OutputToStringArray())).To(Equal(0)) }) It("podman pod prune -f does remove a running container", func() { |