xepoll_thread_spawn: initial implementation
[rainbows.git] / t / t9101-thread-timeout-threshold.sh
blob67e65f6c879da94a1d63558d63f1eeaaa84c782d
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 curl_out
15 rainbows_setup $model 10
16 rainbows -D t9101.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 "8 sleepy requests do not time out" && {
25 > $curl_err
26 for i in 1 2 3 4 5 6 7 8
28 curl --no-buffer -sSf http://$listen/3 \
29 2>> $curl_err >> $curl_out &
30 done
31 wait
32 test 8 -eq "$(wc -l < $curl_out)"
33 test xHI = x"$(sort < $curl_out | uniq)"
36 t_begin "9 sleepy requests, some time out" && {
37 > $curl_err
38 > $curl_out
39 for i in 1 2 3 4 5 6 7 8 9
41 curl -sSf --no-buffer \
42 http://$listen/3 2>> $curl_err >> $curl_out &
43 done
44 wait
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