diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 856dd7dd0f..cc47434b2d 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -187,17 +187,6 @@ var _ = Describe("Podman run networking", func() { Expect(session.OutputToString()).To(ContainSubstring("nameserver 1.1.1.1")) }) - It("podman run network expose port 222", func() { - SkipIfRootless("iptables is not supported for rootless users") - session := podmanTest.Podman([]string{"run", "-dt", "--expose", "222-223", "-P", ALPINE, "/bin/sh"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(ExitCleanly()) - results := SystemExec("iptables", []string{"-t", "nat", "-nvL"}) - Expect(results).Should(ExitCleanly()) - Expect(results.OutputToString()).To(ContainSubstring("222")) - Expect(results.OutputToString()).To(ContainSubstring("223")) - }) - It("podman run -p 80", func() { name := "testctr" session := podmanTest.Podman([]string{"create", "-t", "-p", "80", "--name", name, ALPINE, "/bin/sh"}) @@ -361,7 +350,7 @@ var _ = Describe("Podman run networking", func() { It("podman run --expose 80 -P", func() { name := "testctr" - session := podmanTest.Podman([]string{"create", "-t", "--expose", "80", "-P", "--name", name, ALPINE, "/bin/sh"}) + session := podmanTest.Podman([]string{"run", "-d", "--expose", "80", "-P", "--name", name, ALPINE, "sleep", "100"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) Expect(inspectOut).To(HaveLen(1)) @@ -373,7 +362,7 @@ var _ = Describe("Podman run networking", func() { It("podman run --expose 80/udp -P", func() { name := "testctr" - session := podmanTest.Podman([]string{"create", "-t", "--expose", "80/udp", "-P", "--name", name, ALPINE, "/bin/sh"}) + session := podmanTest.Podman([]string{"run", "-d", "--expose", "80/udp", "-P", "--name", name, ALPINE, "sleep", "100"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) Expect(inspectOut).To(HaveLen(1)) @@ -383,6 +372,22 @@ var _ = Describe("Podman run networking", func() { Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", "0.0.0.0")) }) + It("podman run --expose port range", func() { + name := "testctr" + session := podmanTest.Podman([]string{"run", "-d", "--expose", "222-223", "-P", "--name", name, ALPINE, "sleep", "100"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(ExitCleanly()) + inspectOut := podmanTest.InspectContainer(name) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(2)) + Expect(inspectOut[0].NetworkSettings.Ports["222/tcp"]).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["222/tcp"][0].HostPort).To(Not(Equal("0"))) + Expect(inspectOut[0].NetworkSettings.Ports["222/tcp"][0]).To(HaveField("HostIP", "0.0.0.0")) + Expect(inspectOut[0].NetworkSettings.Ports["223/tcp"]).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["223/tcp"][0].HostPort).To(Not(Equal("0"))) + Expect(inspectOut[0].NetworkSettings.Ports["223/tcp"][0]).To(HaveField("HostIP", "0.0.0.0")) + }) + It("podman run --expose 80 -p 80", func() { name := "testctr" session := podmanTest.Podman([]string{"create", "-t", "--expose", "80", "-p", "80", "--name", name, ALPINE, "/bin/sh"})