diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-09-30 08:58:57 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-09-30 09:50:59 -0400 |
commit | 5766f5b587ffc1b78b7a22c7434326bd149c3dd8 (patch) | |
tree | a12053bd9ec1db3333041879c699e6a888cfc18e /test | |
parent | 6fd0e9bb73ea91911ae1219cfc324bbc2f9f49fd (diff) | |
download | podman-5766f5b587ffc1b78b7a22c7434326bd149c3dd8.tar.gz podman-5766f5b587ffc1b78b7a22c7434326bd149c3dd8.tar.bz2 podman-5766f5b587ffc1b78b7a22c7434326bd149c3dd8.zip |
Make the e2e test network cleanup more robust.
We need to handle removal of non existing network.
This allows the `removeCNINetwork` function
always to be called. This is needed by tests which are trying
to remove the network manually in order to prevent flakes.
Fixes #7809
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/network_create_test.go | 2 | ||||
-rw-r--r-- | test/e2e/network_test.go | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index a81ca19eb..edd76739f 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -58,7 +58,7 @@ func genericPluginsToPortMap(plugins interface{}, pluginType string) (network.Po func (p *PodmanTestIntegration) removeCNINetwork(name string) { session := p.Podman([]string{"network", "rm", "-f", name}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(BeZero()) + Expect(session.ExitCode()).To(BeNumerically("<=", 1)) } func removeNetworkDevice(name string) { diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index 79b530815..aae82e292 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -135,7 +135,6 @@ var _ = Describe("Podman network", func() { }) It("podman network rm", func() { - SkipIfRootless("FIXME: This one is definitely broken in rootless mode") // Setup, use uuid to prevent conflict with other tests uuid := stringid.GenerateNonCryptoID() secondPath := filepath.Join(podmanTest.CNIConfigDir, fmt.Sprintf("%s.conflist", uuid)) @@ -276,6 +275,7 @@ var _ = Describe("Podman network", func() { session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(BeZero()) + defer podmanTest.removeCNINetwork(netName) session = podmanTest.Podman([]string{"pod", "create", "--network", netName}) session.WaitWithDefaultTimeout() @@ -311,11 +311,13 @@ var _ = Describe("Podman network", func() { session := podmanTest.Podman([]string{"network", "create", netName1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(BeZero()) + defer podmanTest.removeCNINetwork(netName1) netName2 := "net2" session = podmanTest.Podman([]string{"network", "create", netName2}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(BeZero()) + defer podmanTest.removeCNINetwork(netName2) session = podmanTest.Podman([]string{"network", "rm", netName1, netName2}) session.WaitWithDefaultTimeout() |