summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-11 18:09:36 -0400
committerGitHub <noreply@github.com>2021-09-11 18:09:36 -0400
commit72662f790bad0a3dc26a6a1498b6daa936702bb6 (patch)
tree602f6d9d4264ac84e4365df9edfd87767b7175a7
parentec3037062d1f9a5ece00ffd465c0f815c06f1b5c (diff)
parent4fbc5b8fe75b3d486a97c013af7a6b085292b46a (diff)
downloadpodman-72662f790bad0a3dc26a6a1498b6daa936702bb6.tar.gz
podman-72662f790bad0a3dc26a6a1498b6daa936702bb6.tar.bz2
podman-72662f790bad0a3dc26a6a1498b6daa936702bb6.zip
Merge pull request #11525 from rhatdan/healthcheck
Stop outputting 'healthy' on healthcheck
-rw-r--r--cmd/podman/healthcheck/run.go5
-rw-r--r--pkg/bindings/test/containers_test.go6
-rw-r--r--test/e2e/healthcheck_run_test.go9
-rw-r--r--test/e2e/play_kube_test.go2
-rw-r--r--test/system/220-healthcheck.bats2
5 files changed, 13 insertions, 11 deletions
diff --git a/cmd/podman/healthcheck/run.go b/cmd/podman/healthcheck/run.go
index fe8dc2573..b03a07bc4 100644
--- a/cmd/podman/healthcheck/run.go
+++ b/cmd/podman/healthcheck/run.go
@@ -6,6 +6,7 @@ import (
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
+ "github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/spf13/cobra"
)
@@ -34,9 +35,9 @@ func run(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
- if response.Status == "unhealthy" {
+ if response.Status == define.HealthCheckUnhealthy {
registry.SetExitCode(1)
+ fmt.Println(response.Status)
}
- fmt.Println(response.Status)
return err
}
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index 4d1361746..b9ed67255 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -326,11 +326,11 @@ var _ = Describe("Podman containers ", func() {
// TODO for the life of me, i cannot get this to work. maybe another set
// of eyes will
// successful healthcheck
- //status := "healthy"
+ //status := define.HealthCheckHealthy
//for i:=0; i < 10; i++ {
// result, err := containers.RunHealthCheck(connText, "hc")
// Expect(err).To(BeNil())
- // if result.Status != "healthy" {
+ // if result.Status != define.HealthCheckHealthy {
// fmt.Println("Healthcheck container still starting, retrying in 1 second")
// time.Sleep(1 * time.Second)
// continue
@@ -338,7 +338,7 @@ var _ = Describe("Podman containers ", func() {
// status = result.Status
// break
//}
- //Expect(status).To(Equal("healthy"))
+ //Expect(status).To(Equal(define.HealthCheckHealthy))
// TODO enable this when wait is working
// healthcheck on a stopped container should be a 409
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index 899c84a14..87f042ed9 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -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))
})
})
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 15bd10616..fcda89fbc 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -1237,7 +1237,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() {
diff --git a/test/system/220-healthcheck.bats b/test/system/220-healthcheck.bats
index f929c6770..e416629e6 100644
--- a/test/system/220-healthcheck.bats
+++ b/test/system/220-healthcheck.bats
@@ -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