Skip to content

Commit

Permalink
Merge pull request containers#16506 from edsantiago/healthcheck_flake
Browse files Browse the repository at this point in the history
healthcheck system tests: try to fix flake
  • Loading branch information
openshift-merge-robot authored Nov 15, 2022
2 parents 320d507 + 1a839a9 commit 5502ddb
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 5502ddb

Please sign in to comment.