From 1093ebb72be3117c5312b702ea89ecfcab5d3452 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 27 May 2024 18:47:31 +0200 Subject: [PATCH] test/system: speed up podman generate systemd - envar This container did not react to sigterm thus we always waited 10s for it to stop. Also do not wait 2s for the logs instead use a retry loop. Signed-off-by: Paul Holzinger --- test/system/250-systemd.bats | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats index 315c40b813..832ee0d742 100644 --- a/test/system/250-systemd.bats +++ b/test/system/250-systemd.bats @@ -142,14 +142,16 @@ function service_cleanup() { @test "podman generate systemd - envar" { cname=$(random_string) FOO=value BAR=%s run_podman create --name $cname --env FOO -e BAR --env MYVAR=myval \ - $IMAGE sh -c 'printenv && sleep 100' + $IMAGE sh -c 'printenv && echo READY; trap 'exit' SIGTERM; while :; do sleep 0.1; done' # Start systemd service to run this container service_setup - # Give container time to start; make sure output looks top-like - sleep 2 - run_podman logs $cname + # Give container time to start and print output + # wait_for_ready returns directly if the logs matches and preserves $output + # for us so we do not have to call podman logs again here if we match the env below. + wait_for_ready $cname + is "$output" ".*FOO=value.*" "FOO environment variable set" is "$output" ".*BAR=%s.*" "BAR environment variable set" is "$output" ".*MYVAR=myval.*" "MYVAL environment variable set"