summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCharlie Doern <cdoern@redhat.com>2022-07-11 13:51:45 -0400
committerCharlie Doern <cdoern@redhat.com>2022-07-25 09:28:26 -0400
commit4724a0000d48d372c84057a065e40a1bd298603a (patch)
tree5324e65ee23a9259c8d55d1c366904729856bc18 /test
parentda1f47921685f40f1b26405278cbf9cb2d06fe09 (diff)
downloadpodman-4724a0000d48d372c84057a065e40a1bd298603a.tar.gz
podman-4724a0000d48d372c84057a065e40a1bd298603a.tar.bz2
podman-4724a0000d48d372c84057a065e40a1bd298603a.zip
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 <cdoern@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/prune_test.go18
1 files changed, 18 insertions, 0 deletions
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() {