initial cool.io support
[rainbows.git] / t / t9101-thread-timeout-threshold.sh
blob7309475208b22b9d3d585bcb119b189055e92bec
1 #!/bin/sh
2 . ./test-lib.sh
3 case $model in
4 ThreadSpawn|ThreadPool) ;;
5 RevThreadSpawn|RevThreadPool) ;;
6 CoolioThreadSpawn|CoolioThreadPool) ;;
7 *) t_info "$0 is only compatible with Thread*"; exit 0 ;;
8 esac
10 t_plan 6 "ThreadTimeout Rack middleware test for $model"
12 t_begin "configure and start" && {
13 rtmpfiles curl_err curl_out
14 rainbows_setup $model 10
15 rainbows -D t9101.ru -c $unicorn_config
16 rainbows_wait_start
19 t_begin "normal request should not timeout" && {
20 test x"HI" = x"$(curl -sSf http://$listen/ 2>> $curl_err)"
23 t_begin "8 sleepy requests do not time out" && {
24 > $curl_err
25 for i in 1 2 3 4 5 6 7 8
27 curl --no-buffer -sSf http://$listen/3 \
28 2>> $curl_err >> $curl_out &
29 done
30 wait
31 test 8 -eq "$(wc -l < $curl_out)"
32 test xHI = x"$(sort < $curl_out | uniq)"
35 t_begin "9 sleepy requests, some time out" && {
36 > $curl_err
37 > $curl_out
38 for i in 1 2 3 4 5 6 7 8 9
40 curl -sSf --no-buffer \
41 http://$listen/3 2>> $curl_err >> $curl_out &
42 done
43 wait
44 grep 408 $curl_err
47 t_begin "kill server" && {
48 kill $rainbows_pid
51 t_begin "no errors in Rainbows! stderr" && {
52 check_stderr
55 t_done