healthcheck_linux: avoid failing transient units

The main purpose of the transient services/timers is to trigger the
healthcheck execution in regular intervals, their own state should
not depend on the result of the healthchecks. This way there are no
failing systemd services unless there is actually a fatal error.

Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
This commit is contained in:
Patrick Wicki
2026-02-06 16:21:16 +01:00
parent 3856389fc9
commit 2828965a75
2 changed files with 4 additions and 3 deletions

View File

@@ -101,12 +101,13 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\\\n\"
run -0 systemctl list-units
cidmatch=$(grep "$cid" <<<"$output")
echo "$cidmatch"
assert "$cidmatch" =~ " $cid-[0-9a-f]+\.timer *.*/podman healthcheck run $cid" \
assert "$cidmatch" =~ " $cid-[0-9a-f]+\.timer *.*/podman healthcheck run --ignore-result $cid" \
"Healthcheck systemd unit exists"
# Check that the right service option is applied so we don't hit the systemd restart limit.
# Even though the code sets StartLimitIntervalSec the systemd command prints StartLimitInterval*U*Sec
run -0 systemctl show "$cid-*.service"
# Use show --all otherwise the glob might not match the already inactive transient unit.
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)