test_isolate: bump versions and simplify
[rainbows.git] / t / t0040-keepalive_requests-setting.sh
blob81194f136bdc2acdd0765afeba4660c41c5a1781
1 #!/bin/sh
2 . ./test-lib.sh
3 t_plan 6 "keepalive_requests limit tests for $model"
5 t_begin "setup and start" && {
6 rainbows_setup $model 50 666
7 rtmpfiles curl_out curl_err
8 grep 'keepalive_timeout 666' $unicorn_config
9 rainbows -E none -D env.ru -c $unicorn_config
10 rainbows_wait_start
13 t_begin "curl requests hit default keepalive_requests limit" && {
14 curl -sSfv http://$listen/[0-101] > $curl_out 2> $curl_err
15 test 1 -eq $(grep 'Connection: close' $curl_err |wc -l)
16 test 101 -eq $(grep 'Connection: keep-alive' $curl_err |wc -l)
19 t_begin "reload with smaller keepalive_requests limit" && {
20 ed -s $unicorn_config <<EOF
21 ,g/Rainbows!/
23 keepalive_requests 5
26 EOF
27 kill -HUP $rainbows_pid
28 test x"$(cat $fifo)" = xSTART
31 t_begin "curl requests hit smaller keepalive_requests limit" && {
32 rm -f $curl_out $curl_err
33 curl -sSfv http://$listen/[1-13] > $curl_out 2> $curl_err
34 test 2 -eq $(grep 'Connection: close' $curl_err |wc -l)
35 test 11 -eq $(grep 'Connection: keep-alive' $curl_err |wc -l)
38 t_begin "killing succeeds" && {
39 kill $rainbows_pid
42 t_begin "check stderr" && {
43 check_stderr
46 t_done