Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Rodák <[email protected]>
  • Loading branch information
Honny1 committed Sep 13, 2024
1 parent 2bab763 commit ee1d02a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions test/system/220-healthcheck.bats
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,22 @@ Log[-1].Output | \"Uh-oh on stdout!\\\nUh-oh on stderr!\\\n\"
run_podman rm -t 0 -f $ctrname
}

@test "podman healthcheck double run" {
local ctrname="c-h-$(safename)"
run_podman run -d --name $ctrname \
--health-cmd "echo Hi" \
--health-startup-cmd "echo start" \
$IMAGE /home/podman/pause
cid="$output"
# --health-startup-cmd "echo start" \

run_podman healthcheck run $ctrname >&3

run_podman inspect $ctrname --format "{{.State.Health.Log}}"
# podman-remote performsa healthcheck run on first startup twice
[ $(echo "$output" | grep -o "Hi" - | wc -l) -eq 1 ]

run_podman rm -t 0 -f $ctrname
}

# vim: filetype=sh
4 changes: 3 additions & 1 deletion test/system/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,12 @@ function run_podman() {
fi

# stdout is only emitted upon error; this printf is to help in debugging
printf "\n%s %s %s %s\n" "$(timestamp)" "$_LOG_PROMPT" "$PODMAN" "$*"
printf "\n%s %s %s %s\n" "$(timestamp)" "$_LOG_PROMPT" "$PODMAN" "$*" >&3
# BATS hangs if a subprocess remains and keeps FD 3 open; this happens
# if podman crashes unexpectedly without cleaning up subprocesses.
echo "RUN: start" >&3
run $silence127 timeout --foreground -v --kill=10 $PODMAN_TIMEOUT $PODMAN $_PODMAN_TEST_OPTS "$@" 3>/dev/null
echo "RUN: end" >&3
# without "quotes", multiple lines are glommed together into one
if [ -n "$output" ]; then
echo "$(timestamp) $output"
Expand Down

0 comments on commit ee1d02a

Please sign in to comment.