summaryrefslogtreecommitdiff
path: root/test/e2e/run_networking_test.go
diff options
context:
space:
mode:
authorLokesh Mandvekar <lsm5@fedoraproject.org>2022-02-11 13:34:18 -0500
committerLokesh Mandvekar <lsm5@fedoraproject.org>2022-02-11 13:34:28 -0500
commit6f9f78f7f2395919f7f9a3a74f002119733e30e9 (patch)
tree7d93a203f3683b442ed3f245f68258bad169a023 /test/e2e/run_networking_test.go
parent564404b4fa7eea5d93756627ce98ca68fd19a72b (diff)
downloadpodman-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/run_networking_test.go')
-rw-r--r--test/e2e/run_networking_test.go91
1 files changed, 83 insertions, 8 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 4c056df10..aa1887f84 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -715,8 +715,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(run.OutputToString()).To(ContainSubstring(ipAddr))
})
- It("podman cni network works across user ns", func() {
- SkipUntilAardvark(podmanTest)
+ It("podman CNI network works across user ns", func() {
+ SkipIfNetavark(podmanTest)
netName := stringid.GenerateNonCryptoID()
create := podmanTest.Podman([]string{"network", "create", netName})
create.WaitWithDefaultTimeout()
@@ -740,6 +740,31 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(log.OutputToString()).To(Equal("podman"))
})
+ It("podman Netavark network works across user ns", func() {
+ SkipIfCNI(podmanTest)
+ netName := createNetworkName("")
+ create := podmanTest.Podman([]string{"network", "create", netName})
+ create.WaitWithDefaultTimeout()
+ Expect(create).Should(Exit(0))
+ defer podmanTest.removeNetwork(netName)
+
+ name := "nc-server"
+ run := podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "-d", "--name", name, "--net", netName, ALPINE, "nc", "-l", "-p", "9480"})
+ run.WaitWithDefaultTimeout()
+ Expect(run).Should(Exit(0))
+
+ // NOTE: we force the k8s-file log driver to make sure the
+ // tests are passing inside a container.
+ run = podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "--rm", "--net", netName, "--uidmap", "0:1:4096", ALPINE, "sh", "-c", fmt.Sprintf("echo podman | nc -w 1 %s.dns.podman 9480", name)})
+ run.WaitWithDefaultTimeout()
+ Expect(run).Should(Exit(0))
+
+ log := podmanTest.Podman([]string{"logs", name})
+ log.WaitWithDefaultTimeout()
+ Expect(log).Should(Exit(0))
+ Expect(log.OutputToString()).To(Equal("podman"))
+ })
+
It("podman run with new:pod and static-ip", func() {
netName := stringid.GenerateNonCryptoID()
ipAddr := "10.25.40.128"
@@ -814,14 +839,50 @@ EXPOSE 2004-2005/tcp`, ALPINE)
pingTest("--net=private")
})
- It("podman run check dnsname plugin", func() {
- SkipUntilAardvark(podmanTest)
+ It("podman run check dnsname plugin with CNI", func() {
+ SkipIfNetavark(podmanTest)
+ pod := "testpod"
+ session := podmanTest.Podman([]string{"pod", "create", "--name", pod})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ net := createNetworkName("IntTest")
+ session = podmanTest.Podman([]string{"network", "create", net})
+ session.WaitWithDefaultTimeout()
+ defer podmanTest.removeNetwork(net)
+ Expect(session).Should(Exit(0))
+
+ pod2 := "testpod2"
+ session = podmanTest.Podman([]string{"pod", "create", "--network", net, "--name", pod2})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"run", "--name", "con1", "--network", net, ALPINE, "nslookup", "con1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"run", "--name", "con2", "--pod", pod, "--network", net, ALPINE, "nslookup", "con2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"run", "--name", "con3", "--pod", pod2, ALPINE, "nslookup", "con1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(1))
+ Expect(session.ErrorToString()).To(ContainSubstring("can't resolve 'con1'"))
+
+ session = podmanTest.Podman([]string{"run", "--name", "con4", "--network", net, ALPINE, "nslookup", pod2 + ".dns.podman"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ })
+
+ It("podman run check dnsname plugin with Netavark", func() {
+ SkipIfCNI(podmanTest)
pod := "testpod"
session := podmanTest.Podman([]string{"pod", "create", "--name", pod})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- net := "IntTest" + stringid.GenerateNonCryptoID()
+ net := createNetworkName("IntTest")
session = podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
@@ -850,9 +911,23 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(session).Should(Exit(0))
})
- It("podman run check dnsname adds dns search domain", func() {
- SkipUntilAardvark(podmanTest)
- net := "dnsname" + stringid.GenerateNonCryptoID()
+ It("podman run check dnsname adds dns search domain with CNI", func() {
+ SkipIfNetavark(podmanTest)
+ net := createNetworkName("dnsname")
+ session := podmanTest.Podman([]string{"network", "create", net})
+ session.WaitWithDefaultTimeout()
+ defer podmanTest.removeNetwork(net)
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"run", "--network", net, ALPINE, "cat", "/etc/resolv.conf"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(ContainSubstring("search dns.podman"))
+ })
+
+ It("podman run check dnsname adds dns search domain with Netavark", func() {
+ SkipIfCNI(podmanTest)
+ net := createNetworkName("dnsname")
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)