6 t_info
"skipping $T since it's not compatible with $model"
11 t_plan
5 "basic test for app.deferred? usage"
13 CONFIG_RU
=app_deferred.ru
15 t_begin
"setup and start" && {
17 rtmpfiles deferred_err deferred_out sync_err sync_out
18 fifo
=$fifo rainbows
-D -c $unicorn_config $CONFIG_RU
22 t_begin
"synchronous requests run in the same thread" && {
23 curl
--no-buffer -sSf http
://$listen/ >> $sync_out 2>> $sync_err &
24 curl
--no-buffer -sSf http
://$listen/ >> $sync_out 2>> $sync_err &
25 curl
--no-buffer -sSf http
://$listen/ >> $sync_out 2>> $sync_err &
28 test 3 -eq "$(count_lines < $sync_out)"
29 test 1 -eq "$(uniq < $sync_out | count_lines)"
32 t_begin
"deferred requests run in a different thread" && {
33 curl
-sSf http
://$listen/deferred
>> $deferred_out 2>> $deferred_err
34 test ! -s $deferred_err
35 sync_thread
="$(uniq < $sync_out)"
36 test x
"$(uniq < $deferred_out)" != x
"$sync_thread"
39 t_begin
"deferred requests run after graceful shutdown" && {
40 # XXX sleeping 5s ought to be enough for SIGQUIT to arrive,
41 # hard to tell with overloaded systems...
43 curl
-sSf --no-buffer http
://$listen/deferred
$s \
44 >$deferred_out 2>$deferred_err &
47 kill -QUIT $rainbows_pid
48 test x
"$msg" = x
"sleeping ${s}s"
49 wait $curl_pid # for curl to finish
51 test ! -s $deferred_err
52 test x
"$(cat $deferred_out)" = 'xdeferred sleep'
55 t_begin
"no errors in stderr" && check_stderr