diff --git a/libpod/define/container_inspect.go b/libpod/define/container_inspect.go index 457de626c9..14fcde37b7 100644 --- a/libpod/define/container_inspect.go +++ b/libpod/define/container_inspect.go @@ -239,11 +239,11 @@ func (s *InspectContainerState) Healthcheck() HealthCheckResults { // HealthCheckResults describes the results/logs from a healthcheck type HealthCheckResults struct { // Status starting, healthy or unhealthy - Status string `json:"Status"` + Status string `json:"Status,omitempty"` // FailingStreak is the number of consecutive failed healthchecks - FailingStreak int `json:"FailingStreak"` + FailingStreak int `json:"FailingStreak,omitzero,omitempty"` // Log describes healthcheck attempts and results - Log []HealthCheckLog `json:"Log"` + Log []HealthCheckLog `json:"Log,omitempty"` } // HealthCheckLog describes the results of a single healthcheck diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index ab8de89262..8eab0cf567 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -34,10 +34,10 @@ var _ = Describe("Podman healthcheck run", func() { session := podmanTest.Podman([]string{"run", "-dt", "--no-healthcheck", "--name", "hc", HEALTHCHECK_IMAGE}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - hc := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.State.Health.Status}}", "hc"}) + hc := podmanTest.Podman([]string{"container", "inspect", "hc"}) hc.WaitWithDefaultTimeout() Expect(hc).Should(Exit(0)) - Expect(hc.OutputToString()).To(Not(ContainSubstring("starting"))) + Expect(hc.OutputToString()).To(ContainSubstring("\"Health\": {},")) }) It("podman run healthcheck and logs should contain healthcheck output", func() { diff --git a/test/system/220-healthcheck.bats b/test/system/220-healthcheck.bats index 828232b39d..00442298f5 100644 --- a/test/system/220-healthcheck.bats +++ b/test/system/220-healthcheck.bats @@ -43,7 +43,7 @@ function _check_health { _check_health "All healthy" " Status | \"healthy\" -FailingStreak | 0 +FailingStreak | null Log[-1].ExitCode | 0 Log[-1].Output | \"Life is Good on stdout\\\nLife is Good on stderr\" "