#!/usr/bin/env bats -*- bats -*- # # tests for podman kill # load helpers @test "podman kill - test signal handling in containers" { # 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 $IMAGE sh -c \ "for i in ${signals[*]}; do trap \"echo got: \$i\" \$i; done; echo READY; while ! test -e /stop; do sleep 0.05; done; echo DONE" # Ignore output regarding pulling/processing container images cid=$(echo "$output" | tail -1) # 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