diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-10-24 17:10:49 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-10-24 17:10:49 -0700 |
commit | e77369a6bde35a4e8925d450aac85f328f87d208 (patch) | |
tree | e43c5b68ac26ee625a372a710a2e302711fa59f1 /t/t9000-rack-app-pool.sh | |
parent | 60ff6aaee097ff1f3ddca34ab53da9b077997dde (diff) | |
download | rainbows-e77369a6bde35a4e8925d450aac85f328f87d208.tar.gz |
Everything passes, and "set -e" prevents us from making any stupid mistakes...
Diffstat (limited to 't/t9000-rack-app-pool.sh')
-rwxr-xr-x | t/t9000-rack-app-pool.sh | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/t/t9000-rack-app-pool.sh b/t/t9000-rack-app-pool.sh index 6c82ff8..b04564b 100755 --- a/t/t9000-rack-app-pool.sh +++ b/t/t9000-rack-app-pool.sh @@ -1,23 +1,41 @@ #!/bin/sh . ./test-lib.sh +nr_client=30 APP_POOL_SIZE=4 -nr_client=30 -rtmpfiles curl_out curl_err -rainbows_setup ThreadSpawn 50 -APP_POOL_SIZE=4 -APP_POOL_SIZE=$APP_POOL_SIZE rainbows -D t9000.ru -c $unicorn_config -rainbows_wait_start - -start=$(date +%s) -for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null) -do - ( curl -sSf http://$listen/ >> $curl_out 2>> $curl_err ) & -done -wait -echo elapsed=$(( $(date +%s) - $start )) -kill $(cat $pid) - -test $APP_POOL_SIZE -eq $(sort < $curl_out | uniq | wc -l) -test ! -s $curl_err - -check_stderr +t_plan 6 "AppPool Rack middleware test" + +t_begin "configure and start" && { + rtmpfiles curl_out curl_err + rainbows_setup ThreadSpawn 50 + APP_POOL_SIZE=$APP_POOL_SIZE rainbows -D t9000.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "launch $nr_client requests" && { + start=$(date +%s) + 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=$(( $(date +%s) - $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 | wc -l) +} + +t_begin "no errors in curl stderr" && { + test ! -s $curl_err +} + +t_begin "no errors in Rainbows! stderr" && { + check_stderr +} + +t_done |