From cddfe3983be63ee5193a19fb6669600f059a839f Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 20 Oct 2020 14:32:33 -0400 Subject: Add a Degraded state to pods Make a distinction between pods that are completely running (all containers running) and those that have some containers going, but not all, by introducing an intermediate state between Stopped and Running called Degraded. A Degraded pod has at least one, but not all, containers running; a Running pod has all containers running. First step to a solution for #7213. Signed-off-by: Matthew Heon --- test/e2e/pod_create_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/e2e/pod_create_test.go') diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index f69b6ca7b..05e9b4e20 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -428,4 +428,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()) + }) }) -- cgit v1.2.3-54-g00ecf