thread_timeout: fix bad comparison
[rainbows.git] / t / t9100-thread-timeout.sh
blob0f802dd78d5d8bfc1912a98ac504a3e20d9116f7
1 #!/bin/sh
2 . ./test-lib.sh
3 case $model in
4 ThreadSpawn|ThreadPool|RevThreadSpawn|RevThreadPool) ;;
5 *) t_info "$0 is only compatible with Thread*"; exit 0 ;;
6 esac
8 t_plan 6 "ThreadTimeout Rack middleware test for $model"
10 t_begin "configure and start" && {
11 rtmpfiles curl_err
12 rainbows_setup
13 rainbows -D t9100.ru -c $unicorn_config
14 rainbows_wait_start
17 t_begin "normal request should not timeout" && {
18 test x"HI" = x"$(curl -sSf http://$listen/ 2>> $curl_err)"
21 t_begin "sleepy request times out with 408" && {
22 rm -f $ok
23 curl -sSf http://$listen/2 2>> $curl_err || > $ok
24 test -e $ok
25 grep 408 $curl_err
28 t_begin "short requests do not timeout while making a long one" && {
29 rm -f $ok $curl_err
30 > $ok
31 curl -sSf http://$listen/2 2>$curl_err >/dev/null &
33 for i in $(awk </dev/null 'BEGIN{for(i=20;--i>=0;)print i}')
35 curl -sSf http://$listen/0.1 >> $ok 2>&1 &
36 test x"HI" = x"$(curl -sSf http://$listen/0.05)"
37 done
38 wait
40 test x"HI" = x"$(curl -sSf http://$listen/)"
41 wait
42 test -f $ok
43 test 20 -eq $(grep '^HI$' $ok | wc -l)
44 test x = x"$(grep -v '^HI$' $ok)"
45 grep 408 $curl_err
48 t_begin "kill server" && {
49 kill $rainbows_pid
52 t_begin "no errors in Rainbows! stderr" && {
53 check_stderr
56 t_done