coolio+xepoll_thread*: use shutdown() for keepalive timeout
[rainbows.git] / t / t9100-thread-timeout.sh
blobbf0c252276e4e530cdfa36e9d4804c117254f498
1 #!/bin/sh
2 . ./test-lib.sh
3 check_threaded_app_dispatch
5 t_plan 6 "ThreadTimeout Rack middleware test for $model"
7 t_begin "configure and start" && {
8 rtmpfiles curl_err
9 rainbows_setup
10 rainbows -D t9100.ru -c $unicorn_config
11 rainbows_wait_start
14 t_begin "normal request should not timeout" && {
15 test x"HI" = x"$(curl -sSf http://$listen/ 2>> $curl_err)"
18 t_begin "sleepy request times out with 408" && {
19 rm -f $ok
20 curl -sSf http://$listen/2 2>> $curl_err || > $ok
21 test -e $ok
22 grep 408 $curl_err
25 t_begin "short requests do not timeout while making a long one" && {
26 rm -f $ok $curl_err
27 > $ok
28 curl -sSf http://$listen/2 2>$curl_err >/dev/null &
30 for i in $(awk </dev/null 'BEGIN{for(i=20;--i>=0;)print i}')
32 curl -sSf http://$listen/0.1 >> $ok 2>&1 &
33 test x"HI" = x"$(curl -sSf http://$listen/0.05)"
34 done
35 wait
37 test x"HI" = x"$(curl -sSf http://$listen/)"
38 wait
39 test -f $ok
40 test 20 -eq $(grep '^HI$' $ok | wc -l)
41 test x = x"$(grep -v '^HI$' $ok)"
42 grep 408 $curl_err
45 t_begin "kill server" && {
46 kill $rainbows_pid
49 t_begin "no errors in Rainbows! stderr" && {
50 check_stderr
53 t_done