Skip to content

Commit

Permalink
healthcheck test failing, try to investigate
Browse files Browse the repository at this point in the history
Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Aug 8, 2024
1 parent 115c9fa commit bbae562
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/system/220-healthcheck.bats
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ function _check_health {

run_podman inspect --format "{{json .State.Healthcheck}}" $ctrname

defer-assertion-failures
parse_table "$tests" | while read field expect;do
actual=$(jq ".$field" <<<"$output")
is "$actual" "$expect" "$testname - .State.Healthcheck.$field"
done
immediate-assertion-failures

# Make sure we can read the healthcheck event in podman events (#20342)
run_podman events --filter container=$ctrname --filter event=health_status \
Expand Down Expand Up @@ -50,7 +52,7 @@ function _check_health {
run_podman inspect $ctrname --format "{{.Config.HealthcheckOnFailureAction}}"
is "$output" "kill" "on-failure action is set to kill"

current_time=$(date --iso-8601=seconds)
current_time=$(date --iso-8601=ns)
# We can't check for 'starting' because a 1-second interval is too
# short; it could run healthcheck before we get to our first check.
#
Expand All @@ -65,7 +67,7 @@ Log[-1].ExitCode | 0
Log[-1].Output | \"Life is Good on stdout\\\nLife is Good on stderr\\\n\"
" "$current_time" "healthy"

current_time=$(date --iso-8601=seconds)
current_time=$(date --iso-8601=ns)
# Force a failure
run_podman exec $ctrname touch /uh-oh
sleep 2
Expand All @@ -81,7 +83,7 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\\\n\"
# name so that the leak check below does not turn into a NOP without noticing.
assert "$(systemctl list-units --type timer | grep $cid)" =~ "podman" "Healthcheck systemd unit exists"

current_time=$(date --iso-8601=seconds)
current_time=$(date --iso-8601=ns)
# After three successive failures, container should no longer be healthy
sleep 5
_check_health $ctrname "Three or more failures" "
Expand Down

0 comments on commit bbae562

Please sign in to comment.