From 74d984e0560b2cb421287395b025687e3aabe118 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 5 Feb 2019 10:41:55 -0800 Subject: Add podman system prune and info commands We are missing the equivalence of the docker system commands This patch set adds `podman system prune` and `podman system info` Signed-off-by: Daniel J Walsh --- test/e2e/info_test.go | 6 ++++++ test/e2e/prune_test.go | 13 +++++++++++++ test/e2e/volume_prune_test.go | 30 ++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) (limited to 'test') diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index 637c04e0a..a50c27dda 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -39,4 +39,10 @@ var _ = Describe("Podman Info", func() { Expect(session.ExitCode()).To(Equal(0)) }) + It("podman system info json output", func() { + session := podmanTest.Podman([]string{"system", "info", "--format=json"}) + session.Wait() + Expect(session.ExitCode()).To(Equal(0)) + + }) }) diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 81fb82b20..74cdc126f 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -88,4 +88,17 @@ var _ = Describe("Podman rm", func() { Expect(len(images.OutputToStringArray())).To(Equal(0)) }) + It("podman system image prune unused images", func() { + SkipIfRemote() + podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true") + prune := podmanTest.Podman([]string{"system", "prune", "-a", "--force"}) + prune.WaitWithDefaultTimeout() + Expect(prune.ExitCode()).To(Equal(0)) + + images := podmanTest.Podman([]string{"images", "-a"}) + images.WaitWithDefaultTimeout() + // all images are unused, so they all should be deleted! + Expect(len(images.OutputToStringArray())).To(Equal(0)) + }) + }) diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go index 008acc2a2..802f3fc4a 100644 --- a/test/e2e/volume_prune_test.go +++ b/test/e2e/volume_prune_test.go @@ -63,4 +63,34 @@ var _ = Describe("Podman volume prune", func() { podmanTest.Cleanup() }) + + It("podman system prune --volume", func() { + session := podmanTest.Podman([]string{"volume", "create"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "create"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(4)) + + session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"volume", "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + + podmanTest.Cleanup() + }) }) -- cgit v1.2.3-54-g00ecf