From 01642c64ea9b472f0fb05196eca55490b12b1691 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 28 May 2024 13:48:08 +0200 Subject: [PATCH] test/system: simplify test signal handling in containers The current logic used podman logs I don't understand way, all we care about is the container output and we can just read the same with a attached podman run, of course we have to move it into the background but it did the some with logs. This also allows us to remove the extra log-driver checks and because podman logs seems to be much slower than the extra run we safe over 10s with this change. Signed-off-by: Paul Holzinger --- test/system/130-kill.bats | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/test/system/130-kill.bats b/test/system/130-kill.bats index 013edc3d5c..c03a7e1121 100644 --- a/test/system/130-kill.bats +++ b/test/system/130-kill.bats @@ -7,35 +7,18 @@ load helpers # bats test_tags=distro-integration @test "podman kill - test signal handling in containers" { - - # Prepare for 'logs -f' - run_podman info --format '{{.Host.LogDriver}}' - log_driver=$output - run_podman info --format '{{.Host.EventLogger}}' - event_logger=$output - opt_log_driver= - if [ $log_driver = "journald" ] && [ $event_logger != "journald" ]; then - # Since PR#10431, 'logs -f' with journald driver is only supported with journald events backend. - # Set '--log driver' temporally because remote doesn't support '--events-backend'. - opt_log_driver="--log-driver k8s-file" - fi + local cname=c-$(random_string 10) + local fifo=${PODMAN_TMPDIR}/podman-kill-fifo.$(random_string 10) + mkfifo $fifo # Start a container that will handle all signals by emitting 'got: N' local -a signals=(1 2 3 4 5 6 8 10 12 13 14 15 16 20 21 22 23 24 25 26 64) - run_podman run -d ${opt_log_driver} $IMAGE sh -c \ + $PODMAN run --name $cname $IMAGE sh -c \ "for i in ${signals[*]}; do trap \"echo got: \$i\" \$i; done; echo READY; while ! test -e /stop; do sleep 0.1; done; - echo DONE" - cid="$output" - - # Run 'logs -f' on that container, but run it in the background with - # redirection to a named pipe from which we (foreground job) read - # and confirm that signals are received. We can't use run_podman here. - local fifo=${PODMAN_TMPDIR}/podman-kill-fifo.$(random_string 10) - mkfifo $fifo - $PODMAN logs -f $cid >$fifo $fifo