about summary refs log tree commit homepage
path: root/t/lib-graceful.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/lib-graceful.sh')
-rw-r--r--t/lib-graceful.sh35
1 files changed, 18 insertions, 17 deletions
diff --git a/t/lib-graceful.sh b/t/lib-graceful.sh
index 3bc3590..45008a5 100644
--- a/t/lib-graceful.sh
+++ b/t/lib-graceful.sh
@@ -1,30 +1,31 @@
 . ./test-lib.sh
-echo "graceful test for model=$model"
 
-rtmpfiles curl_out
-rainbows_setup
-rainbows -D sleep.ru -c $unicorn_config
-rainbows_wait_start
+t_plan 4 "graceful exit test for $model"
 
-curl -sSfv -T- </dev/null http://$listen/5 > $curl_out 2> $fifo &
+t_begin "setup and startup" && {
+        rtmpfiles curl_out
+        rainbows_setup $model
+        rainbows -D sleep.ru -c $unicorn_config
+        rainbows_wait_start
+}
 
-awk -v rainbows_pid=$rainbows_pid '
+t_begin "send a request and SIGQUIT while request is processing" && {
+        curl -sSfv -T- </dev/null http://$listen/5 > $curl_out 2> $fifo &
+        awk -v rainbows_pid=$rainbows_pid '
 { print $0 }
 /100 Continue/ {
         print "awk: sending SIGQUIT to", rainbows_pid
         system("kill -QUIT "rainbows_pid)
 }' $fifo
-wait
+        wait
+}
 
 dbgcat r_err
 
-test x"$(wc -l < $curl_out)" = x1
-nr=$(sort < $curl_out | uniq | wc -l)
+t_begin 'response returned "Hello"' && {
+        test x$(cat $curl_out) = xHello
+}
 
-test "$nr" -eq 1
-test x$(sort < $curl_out | uniq) = xHello
-check_stderr
-while kill -0 $rainbows_pid >/dev/null 2>&1
-do
-        sleep 1
-done
+t_begin 'stderr has no errors' && check_stderr
+
+t_done