1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| | #!/bin/sh
. ./test-lib.sh
case $model in
*CoolioThread*|*RevThread*|Thread*|*Fiber*|Revactor|NeverBlock) ;;
*)
t_info "skipping $T since it's not compatible with $model"
exit 0
;;
esac
nr_client=30 APP_POOL_SIZE=4
t_plan 6 "AppPool Rack middleware test for $model"
t_begin "configure and start" && {
rtmpfiles curl_out curl_err
rainbows_setup $model 50
APP_POOL_SIZE=$APP_POOL_SIZE rainbows -D t9000.ru -c $unicorn_config
rainbows_wait_start
}
t_begin "launch $nr_client requests" && {
start=$(unix_time)
seq="$(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)"
for i in $seq
do
curl -sSf http://$listen/ >> $curl_out 2>> $curl_err &
done
wait
t_info elapsed=$(( $(unix_time) - $start ))
}
t_begin "kill server" && {
kill $rainbows_pid
}
t_begin "$APP_POOL_SIZE instances of app were used" && {
test $APP_POOL_SIZE -eq $(sort < $curl_out | uniq | count_lines)
}
t_begin "no errors in curl stderr" && {
test ! -s $curl_err
}
t_begin "no errors in Rainbows! stderr" && {
check_stderr
}
t_done
|