aboutsummaryrefslogtreecommitdiff
path: root/test/system/032-sig-proxy.bats
blob: 686df0e1bb862a54ee54bf4fc6e38057138778dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bats

load helpers

@test "podman sigkill" {
    $PODMAN run -i --name foo $IMAGE sh -c 'trap "echo BYE;exit 0" INT;echo READY;while :;do sleep 0.1;done' &
    local kidpid=$!

    # Wait for container to appear
    local timeout=5
    while :;do
          sleep 0.5
          run_podman '?' container exists foo
          if [[ $status -eq 0 ]]; then
              break
          fi
          timeout=$((timeout - 1))
          if [[ $timeout -eq 0 ]]; then
              die "Timed out waiting for container to start"
          fi
    done

    wait_for_ready foo

    # Signal, and wait for container to exit
    kill -INT $kidpid
    local timeout=5
    while :;do
          sleep 0.5
          run_podman logs foo
          if [[ "$output" =~ BYE ]]; then
              break
          fi
          timeout=$((timeout - 1))
          if [[ $timeout -eq 0 ]]; then
              die "Timed out waiting for BYE from container"
          fi
    done

    run_podman rm -f -t0 foo
}

# vim: filetype=sh