From 4724a0000d48d372c84057a065e40a1bd298603a Mon Sep 17 00:00:00 2001 From: Charlie Doern Date: Mon, 11 Jul 2022 13:51:45 -0400 Subject: prune filter handling network and container prune could not handle the label!=... filter. vendor in c/common to fix this and add some podman level handling to make everything run smoothly resolves #14182 Signed-off-by: Charlie Doern --- test/e2e/prune_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/e2e') diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 89cc65540..0b1d68aea 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -280,6 +280,24 @@ var _ = Describe("Podman prune", func() { session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) Expect(session.OutputToStringArray()).To(HaveLen(0)) + + // Create new network. + session = podmanTest.Podman([]string{"network", "create", "test1", "--label", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + // Remove all unused networks. + session = podmanTest.Podman([]string{"system", "prune", "-f", "--filter", "label!=foo"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).Should(Equal("Total reclaimed space: 0B")) + + // Unused networks removed. + session = podmanTest.Podman([]string{"network", "ls", "-q", "--filter", "name=^test1$"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + // label should make sure we do not remove this network + Expect(session.OutputToStringArray()).To(HaveLen(1)) }) It("podman system prune - pod,container stopped", func() { -- cgit v1.2.3-54-g00ecf