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 <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2024-05-27 18:47:31 +02:00
parent 15606148e5
commit 1093ebb72b
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 6 additions and 4 deletions

View File

@ -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"