summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-09-27 23:11:31 +0200
committerPaul Holzinger <paul.holzinger@web.de>2020-09-28 10:41:25 +0200
commit393120c13567ef1b6d42bac357eddf44cfa74d16 (patch)
tree990156ecca0b2fee35f942f973b9216a6d117cf4 /test
parent03d01abec6d028e9d5f60615b0451e42d0611d1d (diff)
downloadpodman-393120c13567ef1b6d42bac357eddf44cfa74d16.tar.gz
podman-393120c13567ef1b6d42bac357eddf44cfa74d16.tar.bz2
podman-393120c13567ef1b6d42bac357eddf44cfa74d16.zip
Fix podman network rm --force when network is used by a pod
I added a test to prevent a future regression. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/network_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index c35b82fc1..cdbca3f92 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -263,4 +263,35 @@ var _ = Describe("Podman network", func() {
rmAll.WaitWithDefaultTimeout()
Expect(rmAll.ExitCode()).To(BeZero())
})
+
+ It("podman network remove --force with pod", func() {
+ netName := "testnet"
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"pod", "create", "--network", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ podID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"create", "--pod", podID, ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"network", "rm", "--force", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ // check if pod is deleted
+ session = podmanTest.Podman([]string{"pod", "exists", podID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(1))
+
+ // check if net is deleted
+ session = podmanTest.Podman([]string{"network", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(session.OutputToString()).To(Not(ContainSubstring(netName)))
+ })
})