tests: port all existing tests to TAP library
[rainbows.git] / t / t9000-rack-app-pool.sh
blobb04564b63d5ad40817e880191f0a89fab93be87a
1 #!/bin/sh
2 . ./test-lib.sh
3 nr_client=30 APP_POOL_SIZE=4
5 t_plan 6 "AppPool Rack middleware test"
7 t_begin "configure and start" && {
8 rtmpfiles curl_out curl_err
9 rainbows_setup ThreadSpawn 50
10 APP_POOL_SIZE=$APP_POOL_SIZE rainbows -D t9000.ru -c $unicorn_config
11 rainbows_wait_start
14 t_begin "launch $nr_client requests" && {
15 start=$(date +%s)
16 seq="$(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)"
17 for i in $seq
19 curl -sSf http://$listen/ >> $curl_out 2>> $curl_err &
20 done
21 wait
22 t_info elapsed=$(( $(date +%s) - $start ))
25 t_begin "kill server" && {
26 kill $rainbows_pid
29 t_begin "$APP_POOL_SIZE instances of app were used" && {
30 test $APP_POOL_SIZE -eq $(sort < $curl_out | uniq | wc -l)
33 t_begin "no errors in curl stderr" && {
34 test ! -s $curl_err
37 t_begin "no errors in Rainbows! stderr" && {
38 check_stderr
41 t_done