summaryrefslogtreecommitdiff
path: root/test/e2e/network_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-28 14:13:32 +0000
committerGitHub <noreply@github.com>2020-09-28 14:13:32 +0000
commit97841e55072ae71713922ab6c6c1269e74b08dcf (patch)
tree755a73bf2863a88b5523692f1c920177930620a9 /test/e2e/network_test.go
parent03d01abec6d028e9d5f60615b0451e42d0611d1d (diff)
parent343a10e25fb12685f18ed3600c567397c01a7cc8 (diff)
downloadpodman-97841e55072ae71713922ab6c6c1269e74b08dcf.tar.gz
podman-97841e55072ae71713922ab6c6c1269e74b08dcf.tar.bz2
podman-97841e55072ae71713922ab6c6c1269e74b08dcf.zip
Merge pull request #7793 from Luap99/network-force
Fix podman network rm --force when network is used by a pod
Diffstat (limited to 'test/e2e/network_test.go')
-rw-r--r--test/e2e/network_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index c35b82fc1..85f67fd51 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -263,4 +263,54 @@ 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)))
+ })
+
+ It("podman network remove with two networks", func() {
+ netName1 := "net1"
+ session := podmanTest.Podman([]string{"network", "create", netName1})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ netName2 := "net2"
+ session = podmanTest.Podman([]string{"network", "create", netName2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"network", "rm", netName1, netName2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ lines := session.OutputToStringArray()
+ Expect(lines[0]).To(Equal(netName1))
+ Expect(lines[1]).To(Equal(netName2))
+ })
})