diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-02-02 16:41:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 16:41:26 -0500 |
commit | 89f71177aa4b00ee47245787ec5b5370a500d090 (patch) | |
tree | 2e04e1b684b7dbe3f36cbb1351afe6acd34def6a /test/e2e/network_test.go | |
parent | b4c96535ead19e9f10d9b244c83d299cc3b1d42e (diff) | |
parent | 7d3ad6081f6598b8fa6385409e5109f11f29254f (diff) | |
download | podman-89f71177aa4b00ee47245787ec5b5370a500d090.tar.gz podman-89f71177aa4b00ee47245787ec5b5370a500d090.tar.bz2 podman-89f71177aa4b00ee47245787ec5b5370a500d090.zip |
Merge pull request #12859 from baude/netavarke2e
Enable e2e tests with netavark
Diffstat (limited to 'test/e2e/network_test.go')
-rw-r--r-- | test/e2e/network_test.go | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index 70793fc32..bd30a1f5d 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -118,13 +118,13 @@ var _ = Describe("Podman network", func() { label2 := "abcdef" session := podmanTest.Podman([]string{"network", "create", "--label", label1, net1}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net1) + defer podmanTest.removeNetwork(net1) Expect(session).Should(Exit(0)) net2 := "labelnet" + stringid.GenerateNonCryptoID() session = podmanTest.Podman([]string{"network", "create", "--label", label1, "--label", label2, net2}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net2) + defer podmanTest.removeNetwork(net2) Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1}) @@ -144,7 +144,7 @@ var _ = Describe("Podman network", func() { net := "net" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", net}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net) + defer podmanTest.removeNetwork(net) Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"network", "ls", "--filter", "namr=ab"}) @@ -169,9 +169,16 @@ var _ = Describe("Podman network", func() { netID := "6073aefe03cdf8f29be5b23ea9795c431868a3a22066a6290b187691614fee84" session := podmanTest.Podman([]string{"network", "create", net}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net) + defer podmanTest.removeNetwork(net) Expect(session).Should(Exit(0)) + if podmanTest.NetworkBackend == Netavark { + // netavark uses a different algo for determining the id and it is not repeatable + getid := podmanTest.Podman([]string{"network", "inspect", net, "--format", "{{.ID}}"}) + getid.WaitWithDefaultTimeout() + Expect(getid).Should(Exit(0)) + netID = getid.OutputToString() + } // Tests Default Table Output session = podmanTest.Podman([]string{"network", "ls", "--filter", "id=" + netID}) session.WaitWithDefaultTimeout() @@ -270,7 +277,7 @@ var _ = Describe("Podman network", func() { netName := "net-" + stringid.GenerateNonCryptoID() network := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.50.0/24", netName}) network.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName) + defer podmanTest.removeNetwork(netName) Expect(network).Should(Exit(0)) ctrName := "testCtr" @@ -300,13 +307,13 @@ var _ = Describe("Podman network", func() { netName1 := "net1-" + stringid.GenerateNonCryptoID() network1 := podmanTest.Podman([]string{"network", "create", netName1}) network1.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName1) + defer podmanTest.removeNetwork(netName1) Expect(network1).Should(Exit(0)) netName2 := "net2-" + stringid.GenerateNonCryptoID() network2 := podmanTest.Podman([]string{"network", "create", netName2}) network2.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName2) + defer podmanTest.removeNetwork(netName2) Expect(network2).Should(Exit(0)) ctrName := "testCtr" @@ -337,13 +344,13 @@ var _ = Describe("Podman network", func() { netName1 := "net1-" + stringid.GenerateNonCryptoID() network1 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.0/25", netName1}) network1.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName1) + defer podmanTest.removeNetwork(netName1) Expect(network1).Should(Exit(0)) netName2 := "net2-" + stringid.GenerateNonCryptoID() network2 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.128/26", netName2}) network2.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName2) + defer podmanTest.removeNetwork(netName2) Expect(network2).Should(Exit(0)) ctrName := "testCtr" @@ -380,7 +387,7 @@ var _ = Describe("Podman network", func() { session := podmanTest.Podman([]string{"network", "create", network}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(network) + defer podmanTest.removeNetwork(network) Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"run", "--name", container, "--network", network, "-d", ALPINE, "top"}) @@ -406,7 +413,7 @@ var _ = Describe("Podman network", func() { netName := "net-" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName) + defer podmanTest.removeNetwork(netName) Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"pod", "create", "--network", netName}) @@ -442,13 +449,13 @@ var _ = Describe("Podman network", func() { netName1 := "net1-" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName1}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName1) + defer podmanTest.removeNetwork(netName1) Expect(session).Should(Exit(0)) netName2 := "net2-" + stringid.GenerateNonCryptoID() session = podmanTest.Podman([]string{"network", "create", netName2}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName2) + defer podmanTest.removeNetwork(netName2) Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"network", "rm", netName1, netName2}) @@ -460,11 +467,12 @@ var _ = Describe("Podman network", func() { }) It("podman network with multiple aliases", func() { + SkipUntilAardvark(podmanTest) var worked bool netName := "aliasTest" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(netName) + defer podmanTest.removeNetwork(netName) Expect(session).Should(Exit(0)) interval := time.Duration(250 * time.Millisecond) @@ -510,10 +518,12 @@ var _ = Describe("Podman network", func() { }) It("podman network create/remove macvlan", func() { + // Netavark currently does not do dhcp so the this test fails + SkipIfNetavark(podmanTest) net := "macvlan" + stringid.GenerateNonCryptoID() nc := podmanTest.Podman([]string{"network", "create", "--macvlan", "lo", net}) nc.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net) + defer podmanTest.removeNetwork(net) Expect(nc).Should(Exit(0)) nc = podmanTest.Podman([]string{"network", "rm", net}) @@ -522,10 +532,12 @@ var _ = Describe("Podman network", func() { }) It("podman network create/remove macvlan as driver (-d) no device name", func() { + // Netavark currently does not do dhcp so the this test fails + SkipIfNetavark(podmanTest) net := "macvlan" + stringid.GenerateNonCryptoID() nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net}) nc.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net) + defer podmanTest.removeNetwork(net) Expect(nc).Should(Exit(0)) inspect := podmanTest.Podman([]string{"network", "inspect", net}) @@ -547,10 +559,12 @@ var _ = Describe("Podman network", func() { }) It("podman network create/remove macvlan as driver (-d) with device name", func() { + // Netavark currently does not do dhcp so the this test fails + SkipIfNetavark(podmanTest) net := "macvlan" + stringid.GenerateNonCryptoID() nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", net}) nc.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net) + defer podmanTest.removeNetwork(net) Expect(nc).Should(Exit(0)) inspect := podmanTest.Podman([]string{"network", "inspect", net}) @@ -577,7 +591,7 @@ var _ = Describe("Podman network", func() { net := "net" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", net}) session.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net) + defer podmanTest.removeNetwork(net) Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"network", "exists", net}) @@ -593,7 +607,7 @@ var _ = Describe("Podman network", func() { net := "macvlan" + stringid.GenerateNonCryptoID() nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", "-o", "mtu=1500", "--gateway", "192.168.1.254", "--subnet", "192.168.1.0/24", net}) nc.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net) + defer podmanTest.removeNetwork(net) Expect(nc).Should(Exit(0)) inspect := podmanTest.Podman([]string{"network", "inspect", net}) @@ -622,7 +636,7 @@ var _ = Describe("Podman network", func() { It("podman network prune --filter", func() { // set custom cni directory to prevent flakes - podmanTest.CNIConfigDir = tempdir + podmanTest.NetworkConfigDir = tempdir if IsRemote() { podmanTest.RestartRemoteService() } @@ -630,7 +644,7 @@ var _ = Describe("Podman network", func() { nc := podmanTest.Podman([]string{"network", "create", net1}) nc.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net1) + defer podmanTest.removeNetwork(net1) Expect(nc).Should(Exit(0)) list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"}) @@ -670,7 +684,7 @@ var _ = Describe("Podman network", func() { It("podman network prune", func() { // set custom cni directory to prevent flakes - podmanTest.CNIConfigDir = tempdir + podmanTest.NetworkConfigDir = tempdir if IsRemote() { podmanTest.RestartRemoteService() } @@ -684,12 +698,12 @@ var _ = Describe("Podman network", func() { net2 := net + "2" nc := podmanTest.Podman([]string{"network", "create", net1}) nc.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net1) + defer podmanTest.removeNetwork(net1) Expect(nc).Should(Exit(0)) nc2 := podmanTest.Podman([]string{"network", "create", net2}) nc2.WaitWithDefaultTimeout() - defer podmanTest.removeCNINetwork(net2) + defer podmanTest.removeNetwork(net2) Expect(nc2).Should(Exit(0)) list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"}) |