t0041: less confusing skip message
[rainbows.git] / t / t9100-thread-timeout.sh
blob8d61cc58afdf5d678408a4c8b73a390dd21ffbb4
1 #!/bin/sh
2 . ./test-lib.sh
3 case $model in
4 ThreadSpawn|ThreadPool) ;;
5 RevThreadSpawn|RevThreadPool) ;;
6 CoolioThreadSpawn|CoolioThreadPool) ;;
7 XEpollThreadSpawn) ;;
8 *) t_info "$0 is only compatible with Thread*"; exit 0 ;;
9 esac
11 t_plan 6 "ThreadTimeout Rack middleware test for $model"
13 t_begin "configure and start" && {
14 rtmpfiles curl_err
15 rainbows_setup
16 rainbows -D t9100.ru -c $unicorn_config
17 rainbows_wait_start
20 t_begin "normal request should not timeout" && {
21 test x"HI" = x"$(curl -sSf http://$listen/ 2>> $curl_err)"
24 t_begin "sleepy request times out with 408" && {
25 rm -f $ok
26 curl -sSf http://$listen/2 2>> $curl_err || > $ok
27 test -e $ok
28 grep 408 $curl_err
31 t_begin "short requests do not timeout while making a long one" && {
32 rm -f $ok $curl_err
33 > $ok
34 curl -sSf http://$listen/2 2>$curl_err >/dev/null &
36 for i in $(awk </dev/null 'BEGIN{for(i=20;--i>=0;)print i}')
38 curl -sSf http://$listen/0.1 >> $ok 2>&1 &
39 test x"HI" = x"$(curl -sSf http://$listen/0.05)"
40 done
41 wait
43 test x"HI" = x"$(curl -sSf http://$listen/)"
44 wait
45 test -f $ok
46 test 20 -eq $(grep '^HI$' $ok | wc -l)
47 test x = x"$(grep -v '^HI$' $ok)"
48 grep 408 $curl_err
51 t_begin "kill server" && {
52 kill $rainbows_pid
55 t_begin "no errors in Rainbows! stderr" && {
56 check_stderr
59 t_done