mirror of
https://github.com/containers/podman.git
synced 2025-10-25 10:16:43 +08:00
Stop outputting 'healthy' on healthcheck
We should only print unhealthy if the check fails. Currently this is filling logs when users are running lots of healthchecks. Improves: https://github.com/containers/podman/issues/11157 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
define "github.com/containers/podman/v3/libpod/define"
|
||||
. "github.com/containers/podman/v3/test/utils"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
@ -157,7 +158,7 @@ var _ = Describe("Podman healthcheck run", func() {
|
||||
Expect(hc).Should(Exit(1))
|
||||
|
||||
inspect = podmanTest.InspectContainer("hc")
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal("unhealthy"))
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckUnhealthy))
|
||||
|
||||
})
|
||||
|
||||
@ -171,7 +172,7 @@ var _ = Describe("Podman healthcheck run", func() {
|
||||
Expect(hc).Should(Exit(0))
|
||||
|
||||
inspect := podmanTest.InspectContainer("hc")
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal("healthy"))
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckHealthy))
|
||||
})
|
||||
|
||||
It("podman healthcheck unhealthy but valid arguments check", func() {
|
||||
@ -201,7 +202,7 @@ var _ = Describe("Podman healthcheck run", func() {
|
||||
Expect(hc).Should(Exit(1))
|
||||
|
||||
inspect = podmanTest.InspectContainer("hc")
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal("unhealthy"))
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckUnhealthy))
|
||||
|
||||
foo := podmanTest.Podman([]string{"exec", "hc", "touch", "/foo"})
|
||||
foo.WaitWithDefaultTimeout()
|
||||
@ -212,6 +213,6 @@ var _ = Describe("Podman healthcheck run", func() {
|
||||
Expect(hc).Should(Exit(0))
|
||||
|
||||
inspect = podmanTest.InspectContainer("hc")
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal("healthy"))
|
||||
Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckHealthy))
|
||||
})
|
||||
})
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containers/common/pkg/config"
|
||||
"github.com/containers/podman/v3/libpod/define"
|
||||
"github.com/containers/podman/v3/pkg/util"
|
||||
. "github.com/containers/podman/v3/test/utils"
|
||||
"github.com/containers/storage/pkg/stringid"
|
||||
@ -1209,7 +1210,7 @@ var _ = Describe("Podman play kube", func() {
|
||||
hc := podmanTest.Podman([]string{"healthcheck", "run", "liveness-unhealthy-probe-pod-0-alpine"})
|
||||
hc.WaitWithDefaultTimeout()
|
||||
hcoutput := hc.OutputToString()
|
||||
Expect(hcoutput).To(ContainSubstring("unhealthy"))
|
||||
Expect(hcoutput).To(ContainSubstring(define.HealthCheckUnhealthy))
|
||||
})
|
||||
|
||||
It("podman play kube fail with nonexistent authfile", func() {
|
||||
|
||||
@ -74,7 +74,7 @@ EOF
|
||||
#
|
||||
# So, just force a healthcheck run, then confirm that it's running.
|
||||
run_podman healthcheck run healthcheck_c
|
||||
is "$output" "healthy" "output from 'podman healthcheck run'"
|
||||
is "$output" "" "output from 'podman healthcheck run'"
|
||||
|
||||
_check_health "All healthy" "
|
||||
Status | healthy
|
||||
|
||||
Reference in New Issue
Block a user