summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-08-20 09:52:53 -0500
committerBrent Baude <bbaude@redhat.com>2020-08-21 09:21:15 -0500
commit7b21bcef5881db4f341090d255f6ef204a30dd1e (patch)
treea09d34eeb47a8a4c0df4b2d6105f8ebe34c3b9b6 /test/e2e
parent7ccd821397d03ed545635de2a0b70a68ab4d46db (diff)
downloadpodman-7b21bcef5881db4f341090d255f6ef204a30dd1e.tar.gz
podman-7b21bcef5881db4f341090d255f6ef204a30dd1e.tar.bz2
podman-7b21bcef5881db4f341090d255f6ef204a30dd1e.zip
error when adding container to pod with network information
because a pod's network information is dictated by the infra container at creation, a container cannot be created with network attributes. this has been difficult for users to understand. we now return an error when a container is being created inside a pod and passes any of the following attributes: * static IP (v4 and v6) * static mac * ports -p (i.e. -p 8080:80) * exposed ports (i.e. 222-225) * publish ports from image -P Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/create_test.go62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 72a3a7717..9cfed263a 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -542,4 +542,66 @@ var _ = Describe("Podman create", func() {
Expect(session.ExitCode()).To(Not(Equal(0)))
Expect(session.ErrorToString()).To(ContainSubstring("Invalid umask"))
})
+
+ It("create container in pod with IP should fail", func() {
+ SkipIfRootless()
+ name := "createwithstaticip"
+ pod := podmanTest.RunTopContainerInPod("", "new:"+name)
+ pod.WaitWithDefaultTimeout()
+ Expect(pod.ExitCode()).To(BeZero())
+
+ session := podmanTest.Podman([]string{"create", "--pod", name, "--ip", "192.168.1.2", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).ToNot(BeZero())
+ })
+
+ It("create container in pod with mac should fail", func() {
+ SkipIfRootless()
+ name := "createwithstaticmac"
+ pod := podmanTest.RunTopContainerInPod("", "new:"+name)
+ pod.WaitWithDefaultTimeout()
+ Expect(pod.ExitCode()).To(BeZero())
+
+ session := podmanTest.Podman([]string{"create", "--pod", name, "--mac-address", "52:54:00:6d:2f:82", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).ToNot(BeZero())
+ })
+
+ It("create container in pod with network should fail", func() {
+ SkipIfRootless()
+ name := "createwithnetwork"
+ pod := podmanTest.RunTopContainerInPod("", "new:"+name)
+ pod.WaitWithDefaultTimeout()
+ Expect(pod.ExitCode()).To(BeZero())
+
+ session := podmanTest.Podman([]string{"create", "--pod", name, "--network", "foobar", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ //Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session.ExitCode()).To(BeZero())
+ })
+
+ It("create container in pod with ports should fail", func() {
+ SkipIfRootless()
+ name := "createwithports"
+ pod := podmanTest.RunTopContainerInPod("", "new:"+name)
+ pod.WaitWithDefaultTimeout()
+ Expect(pod.ExitCode()).To(BeZero())
+
+ session := podmanTest.Podman([]string{"create", "--pod", name, "-p", "80:80", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).ToNot(BeZero())
+ })
+
+ It("create container in pod ppublish ports should fail", func() {
+ SkipIfRootless()
+ name := "createwithpublishports"
+ pod := podmanTest.RunTopContainerInPod("", "new:"+name)
+ pod.WaitWithDefaultTimeout()
+ Expect(pod.ExitCode()).To(BeZero())
+
+ session := podmanTest.Podman([]string{"create", "--pod", name, "-P", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).ToNot(BeZero())
+ })
+
})