diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-02-07 08:52:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 08:52:23 -0500 |
commit | b1dcd025c6118725b35bd89f31a77ed63528db7d (patch) | |
tree | f7d87d2ed51d3c79ff720ac365075f350ab7daaf /test/e2e | |
parent | f6b0abfa8a6604ec18b22da787f7edc67eb99fe5 (diff) | |
parent | 3cf64a8e9a52b4488a9161305d173f4808673c1a (diff) | |
download | podman-b1dcd025c6118725b35bd89f31a77ed63528db7d.tar.gz podman-b1dcd025c6118725b35bd89f31a77ed63528db7d.tar.bz2 podman-b1dcd025c6118725b35bd89f31a77ed63528db7d.zip |
Merge pull request #13129 from flouthoc/healthcheck-session-read-from-pipe
healthcheck, libpod: Read healthcheck event output from os pipe
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/healthcheck_run_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index c84488145..866edbf0e 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -54,6 +54,28 @@ var _ = Describe("Podman healthcheck run", func() { Expect(hc).Should(Exit(125)) }) + It("podman run healthcheck and logs should contain healthcheck output", func() { + session := podmanTest.Podman([]string{"run", "--name", "test-logs", "-dt", "--health-interval", "1s", "--health-cmd", "echo working", "busybox", "sleep", "3600"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + // Buy a little time to get container running + for i := 0; i < 5; i++ { + hc := podmanTest.Podman([]string{"healthcheck", "run", "test-logs"}) + hc.WaitWithDefaultTimeout() + exitCode := hc.ExitCode() + if exitCode == 0 || i == 4 { + break + } + time.Sleep(1 * time.Second) + } + + hc := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.State.Healthcheck.Log}}", "test-logs"}) + hc.WaitWithDefaultTimeout() + Expect(hc).Should(Exit(0)) + Expect(hc.OutputToString()).To(ContainSubstring("working")) + }) + It("podman healthcheck from image's config (not container config)", func() { // Regression test for #12226: a health check may be defined in // the container or the container-config of an image. |