From 0b34b4a59cf090a47a2a13cc4814954c497b3d49 Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Fri, 15 Mar 2019 17:41:03 -0400 Subject: Add podman pod prune podman system prune would leave pods be, and not prune them if they were stopped. Fix this by adding a `podman pod prune` command that prunes stopped pods similarly to containers. Signed-off-by: Peter Hunt --- test/e2e/prune_test.go | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'test/e2e') diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 682f7ff2b..544d54b50 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -14,7 +14,7 @@ LABEL RUN podman --version RUN apk update RUN apk add bash` -var _ = Describe("Podman rm", func() { +var _ = Describe("Podman prune", func() { var ( tempdir string err error @@ -101,4 +101,37 @@ var _ = Describe("Podman rm", func() { Expect(len(images.OutputToStringArray())).To(Equal(0)) }) + It("podman system prune pods", func() { + SkipIfRemote() + + session := podmanTest.Podman([]string{"pod", "create"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"pod", "create"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"pod", "start", "-l"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"pod", "stop", "-l"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + pods := podmanTest.Podman([]string{"pod", "ps"}) + pods.WaitWithDefaultTimeout() + Expect(pods.ExitCode()).To(Equal(0)) + Expect(len(pods.OutputToStringArray())).To(Equal(3)) + + prune := podmanTest.Podman([]string{"system", "prune", "-f"}) + prune.WaitWithDefaultTimeout() + Expect(prune.ExitCode()).To(Equal(0)) + + pods = podmanTest.Podman([]string{"pod", "ps"}) + pods.WaitWithDefaultTimeout() + Expect(pods.ExitCode()).To(Equal(0)) + Expect(len(pods.OutputToStringArray())).To(Equal(2)) + }) }) -- cgit v1.2.3-54-g00ecf