about summary refs log tree commit homepage
path: root/t/t9000-rack-app-pool.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t9000-rack-app-pool.sh')
-rwxr-xr-xt/t9000-rack-app-pool.sh58
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