test_isolate: prevent concurrent execution
[rainbows.git] / t / t0010-keepalive-timeout-effective.sh
blob9d4d65187eecc55884a20f5b64da4e96422e6bc5
1 #!/bin/sh
2 . ./test-lib.sh
3 t_plan 6 "keepalive_timeout tests for $model"
5 t_begin "setup and start" && {
6 rainbows_setup
7 rainbows -D env.ru -c $unicorn_config
8 rainbows_wait_start
11 t_begin 'check server up' && {
12 curl -sSf http://$listen/
15 t_begin "send keepalive response that does not expect close" && {
16 req='GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'
17 t0=$(date +%s)
19 cat $fifo > $tmp &
20 printf "$req"
21 wait
22 date +%s > $ok
23 ) | socat - TCP:$listen > $fifo
24 now="$(cat $ok)"
25 elapsed=$(( $now - $t0 ))
26 t_info "elapsed=$elapsed (expecting >=5s)"
27 test $elapsed -ge 5
30 t_begin 'keepalive not unreasonably long' && {
31 test $elapsed -lt 15
34 t_begin "killing succeeds" && {
35 kill $rainbows_pid
38 t_begin "check stderr" && {
39 check_stderr
42 t_done