summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-02-03 18:40:31 +0530
committerAditya R <arajan@redhat.com>2022-02-04 21:15:03 +0530
commit4f77331c9df173c679654921b21cc32143269c8d (patch)
tree98346affbc594d59adbede30c7f22ba13e3c16a0 /test/e2e
parentf2263fade4aef30fd619b648e4d1ca4aaf6bd506 (diff)
downloadpodman-4f77331c9df173c679654921b21cc32143269c8d.tar.gz
podman-4f77331c9df173c679654921b21cc32143269c8d.tar.bz2
podman-4f77331c9df173c679654921b21cc32143269c8d.zip
healthcheck, libpod: Read healthcheck event output from os pipe
It seems we are ignoring output from healthcheck session. Open a valid pipe to healthcheck session in order read its output. Use common pipe for both `stdout/stderr` since that was the previous behviour as well. Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/healthcheck_run_test.go22
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.