aboutsummaryrefslogtreecommitdiff
path: root/test/e2e/healthcheck_run_test.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-11-09 14:43:55 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-11-09 15:32:36 +0100
commitfaf450ea18179bb0e4ae1213d3ca6c126b04b452 (patch)
tree67f72a91fc4191a6155e1e51500fe44483c463e4 /test/e2e/healthcheck_run_test.go
parent3ccd999340462a5af62ac145c339d9c251721aec (diff)
downloadpodman-faf450ea18179bb0e4ae1213d3ca6c126b04b452.tar.gz
podman-faf450ea18179bb0e4ae1213d3ca6c126b04b452.tar.bz2
podman-faf450ea18179bb0e4ae1213d3ca6c126b04b452.zip
support health checks from image configs
Health checks may be defined in the container config or the config of an image. So far, Podman only looked at the container config. The plumbing happened in libimage but add a regression test to Podman as well to make sure the glue code will not regress. Note that I am pinning github.com/onsi/gomega to v1.16.0 since v1.17.0 requires go 1.16 which in turn is breaking CI. Fixes: #12226 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test/e2e/healthcheck_run_test.go')
-rw-r--r--test/e2e/healthcheck_run_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index b2666c789..c9a6f926f 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -52,6 +52,18 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(125))
})
+ 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.
+ session := podmanTest.Podman([]string{"create", "--name", "hc", "quay.io/libpod/healthcheck:config-only", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ hc := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Healthcheck}}", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc).Should(Exit(0))
+ Expect(hc.OutputToString()).To(Equal("{[CMD-SHELL curl -f http://localhost/ || exit 1] 0s 5m0s 3s 0}"))
+ })
+
It("podman disable healthcheck with --health-cmd=none on valid container", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--health-cmd", "none", "--name", "hc", healthcheck})
session.WaitWithDefaultTimeout()