From 1a839a96dc4cdf10ae90e9496a02abf1e4011618 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Mon, 14 Nov 2022 12:28:27 -0700 Subject: [PATCH] healthcheck system tests: try to fix flake Weird one-off flake seen: # ... healthcheck run Error: container SHA is not running The only way I can see this happening is if the healthcheck auto-timer triggered, which seems impossible because that should be 30s and the log timestamps show this test taking 18s. But, shrug, let's see if disabling the timer works. I don't have high hopes that this will fix anything, but it's probably a good idea regardless. Also, since this test loops over different policies, include policy name in error messages as a courtesy. (It's obtainable anyway by scrolling up) Signed-off-by: Ed Santiago --- test/system/220-healthcheck.bats | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/system/220-healthcheck.bats b/test/system/220-healthcheck.bats index 56ac404757..8df9923c22 100644 --- a/test/system/220-healthcheck.bats +++ b/test/system/220-healthcheck.bats @@ -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 @@ -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 @@ -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"