diff options
author | Lokesh Mandvekar <lsm5@fedoraproject.org> | 2022-02-11 13:34:18 -0500 |
---|---|---|
committer | Lokesh Mandvekar <lsm5@fedoraproject.org> | 2022-02-11 13:34:28 -0500 |
commit | 6f9f78f7f2395919f7f9a3a74f002119733e30e9 (patch) | |
tree | 7d93a203f3683b442ed3f245f68258bad169a023 /test/e2e/network_test.go | |
parent | 564404b4fa7eea5d93756627ce98ca68fd19a72b (diff) | |
download | podman-6f9f78f7f2395919f7f9a3a74f002119733e30e9.tar.gz podman-6f9f78f7f2395919f7f9a3a74f002119733e30e9.tar.bz2 podman-6f9f78f7f2395919f7f9a3a74f002119733e30e9.zip |
enable netavark specific tests
These are copies of the CNI tests with modifications wherever
neccessary.
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
Diffstat (limited to 'test/e2e/network_test.go')
-rw-r--r-- | test/e2e/network_test.go | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index bd30a1f5d..89a9005f5 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -466,10 +466,61 @@ var _ = Describe("Podman network", func() { Expect(lines[1]).To(Equal(netName2)) }) - It("podman network with multiple aliases", func() { - SkipUntilAardvark(podmanTest) + It("podman CNI network with multiple aliases", func() { + SkipIfNetavark(podmanTest) + var worked bool + netName := createNetworkName("aliasTest") + session := podmanTest.Podman([]string{"network", "create", netName}) + session.WaitWithDefaultTimeout() + defer podmanTest.removeNetwork(netName) + Expect(session).Should(Exit(0)) + + interval := time.Duration(250 * time.Millisecond) + for i := 0; i < 6; i++ { + n := podmanTest.Podman([]string{"network", "exists", netName}) + n.WaitWithDefaultTimeout() + worked = n.ExitCode() == 0 + if worked { + break + } + time.Sleep(interval) + interval *= 2 + } + + top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx}) + top.WaitWithDefaultTimeout() + Expect(top).Should(Exit(0)) + interval = time.Duration(250 * time.Millisecond) + // Wait for the nginx service to be running + for i := 0; i < 6; i++ { + // Test curl against the container's name + c1 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web"}) + c1.WaitWithDefaultTimeout() + worked = c1.ExitCode() == 0 + if worked { + break + } + time.Sleep(interval) + interval *= 2 + } + Expect(worked).To(BeTrue()) + + // Nginx is now running so no need to do a loop + // Test against the first alias + c2 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web1"}) + c2.WaitWithDefaultTimeout() + Expect(c2).Should(Exit(0)) + + // Test against the second alias + c3 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web2"}) + c3.WaitWithDefaultTimeout() + Expect(c3).Should(Exit(0)) + }) + + It("podman Netavark network with multiple aliases", func() { + SkipIfCNI(podmanTest) var worked bool - netName := "aliasTest" + stringid.GenerateNonCryptoID() + netName := createNetworkName("aliasTest") session := podmanTest.Podman([]string{"network", "create", netName}) session.WaitWithDefaultTimeout() defer podmanTest.removeNetwork(netName) |