github.com/containers/podman/v5@v5.1.0-rc1/test/system/helpers.sig-proxy.bash (about) 1 # -*- bash -*- 2 # 3 # BATS helpers for sig-proxy functionality 4 # 5 6 # Command to run in each of the tests. 7 SLEEPLOOP='trap "echo BYE;exit 0" INT;echo READY;while :;do sleep 0.1;done' 8 9 # Main test code: wait for container to exist and be ready, send it a 10 # signal, wait for container to acknowledge and exit. 11 function _test_sigproxy() { 12 local cname=$1 13 local kidpid=$2 14 15 # Wait for container to appear 16 local timeout=10 17 while :;do 18 sleep 0.5 19 run_podman '?' container exists $cname 20 if [[ $status -eq 0 ]]; then 21 break 22 fi 23 timeout=$((timeout - 1)) 24 if [[ $timeout -eq 0 ]]; then 25 run_podman ps -a 26 die "Timed out waiting for container $cname to start" 27 fi 28 done 29 30 # Now that container exists, wait for it to declare itself READY 31 wait_for_ready $cname 32 33 # Signal, and wait for container to exit 34 kill -INT $kidpid 35 timeout=20 36 while :;do 37 sleep 0.5 38 run_podman logs $cname 39 if [[ "$output" =~ BYE ]]; then 40 break 41 fi 42 timeout=$((timeout - 1)) 43 if [[ $timeout -eq 0 ]]; then 44 run_podman ps -a 45 die "Timed out waiting for BYE from container" 46 fi 47 done 48 49 run_podman rm -f -t0 $cname 50 }