summaryrefslogtreecommitdiff
path: root/test/e2e/pod_create_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/pod_create_test.go')
-rw-r--r--test/e2e/pod_create_test.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index f69b6ca7b..95870788e 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -245,6 +245,24 @@ var _ = Describe("Podman pod create", func() {
}
})
+ It("podman container in pod with IP address shares IP address", func() {
+ SkipIfRootless("Rootless does not support --ip")
+ podName := "test"
+ ctrName := "testCtr"
+ ip := GetRandomIPAddress()
+ podCreate := podmanTest.Podman([]string{"pod", "create", "--ip", ip, "--name", podName})
+ podCreate.WaitWithDefaultTimeout()
+ Expect(podCreate.ExitCode()).To(Equal(0))
+ podCtr := podmanTest.Podman([]string{"run", "--name", ctrName, "--pod", podName, "-d", "-t", ALPINE, "top"})
+ podCtr.WaitWithDefaultTimeout()
+ Expect(podCtr.ExitCode()).To(Equal(0))
+ ctrInspect := podmanTest.Podman([]string{"inspect", ctrName})
+ ctrInspect.WaitWithDefaultTimeout()
+ Expect(ctrInspect.ExitCode()).To(Equal(0))
+ ctrJSON := ctrInspect.InspectContainerToJSON()
+ Expect(ctrJSON[0].NetworkSettings.IPAddress).To(Equal(ip))
+ })
+
It("podman create pod with IP address and no infra should fail", func() {
name := "test"
ip := GetRandomIPAddress()
@@ -428,4 +446,34 @@ entrypoint ["/fromimage"]
Expect(check.ExitCode()).To(Equal(0))
Expect(check.OutputToString()).To(Equal("[port_handler=slirp4netns]"))
})
+
+ It("podman pod status test", func() {
+ podName := "testpod"
+ create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
+ create.WaitWithDefaultTimeout()
+ Expect(create.ExitCode()).To(Equal(0))
+
+ status1 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
+ status1.WaitWithDefaultTimeout()
+ Expect(status1.ExitCode()).To(Equal(0))
+ Expect(strings.Contains(status1.OutputToString(), "Created")).To(BeTrue())
+
+ ctr1 := podmanTest.Podman([]string{"run", "--pod", podName, "-d", ALPINE, "top"})
+ ctr1.WaitWithDefaultTimeout()
+ Expect(ctr1.ExitCode()).To(Equal(0))
+
+ status2 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
+ status2.WaitWithDefaultTimeout()
+ Expect(status2.ExitCode()).To(Equal(0))
+ Expect(strings.Contains(status2.OutputToString(), "Running")).To(BeTrue())
+
+ ctr2 := podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
+ ctr2.WaitWithDefaultTimeout()
+ Expect(ctr2.ExitCode()).To(Equal(0))
+
+ status3 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
+ status3.WaitWithDefaultTimeout()
+ Expect(status3.ExitCode()).To(Equal(0))
+ Expect(strings.Contains(status3.OutputToString(), "Degraded")).To(BeTrue())
+ })
})