Skip to content

Commit

Permalink
healthcheck system tests: try to fix flake
Browse files Browse the repository at this point in the history
Weird one-off flake seen:

   # ... healthcheck run <containername>
   Error: container SHA is not running

The only way I can see this happening is if the healthcheck
auto-timer triggered, which seems impossible because that
should be 30s and the log timestamps show this test taking
18s. But, shrug, let's see if disabling the timer works. I
don't have high hopes that this will fix anything, but it's
probably a good idea regardless.

Also, since this test loops over different policies, include
policy name in error messages as a courtesy. (It's obtainable
anyway by scrolling up)

Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Nov 14, 2022
1 parent 43cef62 commit 1a839a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/system/220-healthcheck.bats
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\"
--health-cmd /healthcheck \
--health-retries=1 \
--health-on-failure=$policy \
--health-interval=disable \
$img

# healthcheck should succeed
Expand All @@ -107,7 +108,7 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\"

# healthcheck should now fail, with exit status 1 and 'unhealthy' output
run_podman 1 healthcheck run $ctr
is "$output" "unhealthy" "output from 'podman healthcheck run'"
is "$output" "unhealthy" "output from 'podman healthcheck run' (policy: $policy)"

run_podman inspect $ctr --format "{{.State.Status}} {{.Config.HealthcheckOnFailureAction}}"
if [[ $policy == "restart" ]];then
Expand All @@ -118,10 +119,10 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\"
# Container is still running and health check still broken
is "$output" "running $policy" "container continued running"
run_podman 1 healthcheck run $ctr
is "$output" "unhealthy" "output from 'podman healthcheck run'"
is "$output" "unhealthy" "output from 'podman healthcheck run' (policy: $policy)"
else
# kill and stop yield the container into a non-running state
is "$output" ".* $policy" "container was stopped/killed"
is "$output" ".* $policy" "container was stopped/killed (policy: $policy)"
assert "$output" != "running $policy"
# also make sure that it's not stuck in the stopping state
assert "$output" != "stopping $policy"
Expand Down

0 comments on commit 1a839a9

Please sign in to comment.