doc: cleanup rdoc for Rainbows module
[rainbows.git] / t / t0017-keepalive-timeout-zero.sh
blob0f81d206ddea038b5b520aec291be90a1d588852
1 #!/bin/sh
2 . ./test-lib.sh
3 t_plan 6 "keepalive_timeout 0 tests for $model"
5 t_begin "setup and start" && {
6 rainbows_setup $model 2 0
7 grep 'keepalive_timeout 0' $unicorn_config
8 rainbows -D env.ru -c $unicorn_config
9 rainbows_wait_start
12 t_begin 'check server responds with Connection: close' && {
13 curl -sSfi http://$listen/ | grep 'Connection: close'
16 t_begin "send keepalive response that does not expect close" && {
17 req='GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'
18 t0=$(date +%s)
20 cat $fifo > $tmp &
21 printf "$req"
22 wait
23 date +%s > $ok
24 ) | socat - TCP:$listen > $fifo
25 now="$(cat $ok)"
26 elapsed=$(( $now - $t0 ))
27 t_info "elapsed=$elapsed (expecting <=3)"
28 test $elapsed -le 3
31 t_begin "'Connection: close' header set" && {
32 grep 'Connection: close' $tmp
35 t_begin "killing succeeds" && {
36 kill $rainbows_pid
39 t_begin "check stderr" && {
40 check_stderr
43 t_done