summary refs log tree commit homepage
path: root/t/t0700-app-deferred.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t0700-app-deferred.sh')
-rwxr-xr-xt/t0700-app-deferred.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/t/t0700-app-deferred.sh b/t/t0700-app-deferred.sh
index 90614b2..188fdde 100755
--- a/t/t0700-app-deferred.sh
+++ b/t/t0700-app-deferred.sh
@@ -15,7 +15,7 @@ CONFIG_RU=app_deferred.ru
 t_begin "setup and start" && {
         rainbows_setup
         rtmpfiles deferred_err deferred_out sync_err sync_out
-        rainbows -D -c $unicorn_config $CONFIG_RU
+        fifo=$fifo rainbows -D -c $unicorn_config $CONFIG_RU
         rainbows_wait_start
 }
 
@@ -36,8 +36,20 @@ t_begin "deferred requests run in a different thread" && {
         test x"$(uniq < $deferred_out)" != x"$sync_thread"
 }
 
-t_begin "termination signal sent" && {
-        kill $rainbows_pid
+t_begin "deferred requests run after graceful shutdown" && {
+        # XXX sleeping 5s ought to be enough for SIGQUIT to arrive,
+        # hard to tell with overloaded systems...
+        s=5
+        curl -sSf --no-buffer http://$listen/deferred$s \
+                >$deferred_out 2>$deferred_err &
+        curl_pid=$!
+        msg="$(cat $fifo)"
+        kill -QUIT $rainbows_pid
+        test x"$msg" = x"sleeping ${s}s"
+        wait $curl_pid # for curl to finish
+        test $? -eq 0
+        test ! -s $deferred_err
+        test x"$(cat $deferred_out)" = 'xdeferred sleep'
 }
 
 t_begin "no errors in stderr" && check_stderr