mirror of
https://github.com/containers/podman.git
synced 2026-09-17 08:11:40 -04:00
Fix healthcheck flake by capturing time before systemctl checks
After _check_health "First failure" returns with FailingStreak=2, the 3rd failure fires during the subsequent systemctl checks (~1s interval), emitting the "unhealthy" event before current_time was captured. Move current_time before those checks so --since doesn't miss the event. Signed-off-by: Jan Rodák <hony.com@seznam.cz>
This commit is contained in:
1 file changed
+4
-1
@@ -96,6 +96,10 @@ Log[-1].ExitCode | 1
|
||||
Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\\\n\"
|
||||
" "$current_time" "healthy"
|
||||
|
||||
# Capture time before systemctl checks so we don't miss the "unhealthy"
|
||||
# event that may fire during those checks (health-interval is only 1s).
|
||||
current_time=$(date --iso-8601=ns)
|
||||
|
||||
# Check that we now we do have valid podman units with this
|
||||
# name so that the leak check below does not turn into a NOP without noticing.
|
||||
run -0 systemctl list-units
|
||||
@@ -110,7 +114,6 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\\\n\"
|
||||
run -0 systemctl show --all "$cid-*.service"
|
||||
assert "$output" =~ "StartLimitIntervalUSec=0" "The hc service has the right interval set"
|
||||
|
||||
current_time=$(date --iso-8601=ns)
|
||||
# After three successive failures, container should no longer be healthy
|
||||
_check_health $ctrname "Four or more failures" "
|
||||
Status | \"unhealthy\"
|
||||
|
||||
Reference in new issue
Block a user