summaryrefslogtreecommitdiff
path: root/test/e2e/network_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-14 13:12:40 -0400
committerGitHub <noreply@github.com>2021-05-14 13:12:40 -0400
commitfabaa256676d3cfb611f89922ccaf3405718a6f0 (patch)
tree82648373f876b243f5c513fa74934940d1b95811 /test/e2e/network_test.go
parentd05cc0a04a0f5c401624de249505bd160231e2ff (diff)
parent5e6405334c3d0422b5ec7cd09ef9c58d8f558dba (diff)
downloadpodman-fabaa256676d3cfb611f89922ccaf3405718a6f0.tar.gz
podman-fabaa256676d3cfb611f89922ccaf3405718a6f0.tar.bz2
podman-fabaa256676d3cfb611f89922ccaf3405718a6f0.zip
Merge pull request #10254 from jmguzik/prune-filter-cli
Add support for cli network prune --filter flag
Diffstat (limited to 'test/e2e/network_test.go')
-rw-r--r--test/e2e/network_test.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index ff2e1eb66..6f28d7e19 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -584,6 +584,52 @@ var _ = Describe("Podman network", func() {
Expect(nc.ExitCode()).To(Equal(0))
})
+ It("podman network prune --filter", func() {
+ net1 := "macvlan" + stringid.GenerateNonCryptoID() + "net1"
+
+ nc := podmanTest.Podman([]string{"network", "create", net1})
+ nc.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net1)
+ Expect(nc.ExitCode()).To(Equal(0))
+
+ list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
+ list.WaitWithDefaultTimeout()
+ Expect(list.ExitCode()).To(BeZero())
+
+ Expect(StringInSlice(net1, list.OutputToStringArray())).To(BeTrue())
+ if !isRootless() {
+ Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
+ }
+
+ // -f needed only to skip y/n question
+ prune := podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=50"})
+ prune.WaitWithDefaultTimeout()
+ Expect(prune.ExitCode()).To(BeZero())
+
+ listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
+ listAgain.WaitWithDefaultTimeout()
+ Expect(listAgain.ExitCode()).To(BeZero())
+
+ Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeTrue())
+ if !isRootless() {
+ Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
+ }
+
+ // -f needed only to skip y/n question
+ prune = podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=5000000000000"})
+ prune.WaitWithDefaultTimeout()
+ Expect(prune.ExitCode()).To(BeZero())
+
+ listAgain = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
+ listAgain.WaitWithDefaultTimeout()
+ Expect(listAgain.ExitCode()).To(BeZero())
+
+ Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeFalse())
+ if !isRootless() {
+ Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
+ }
+ })
+
It("podman network prune", func() {
// Create two networks
// Check they are there