"keepalive_timeout 0" (really) disables keepalive
[rainbows.git] / t / t0700-app-deferred.sh
blob8d4b4e2c3f4e30f7d1fd6fde81f5857e5bcb8be0
1 #!/bin/sh
2 . ./test-lib.sh
3 case $model in
4 EventMachine) ;;
5 *)
6 t_info "skipping $T since it's not compatible with $model"
7 exit 0
8 ;;
9 esac
11 t_plan 5 "basic test for app.deferred? usage"
13 CONFIG_RU=app_deferred.ru
15 t_begin "setup and start" && {
16 rainbows_setup
17 rtmpfiles deferred_err deferred_out sync_err sync_out
18 rainbows -D -c $unicorn_config $CONFIG_RU
19 rainbows_wait_start
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 &
26 wait
27 test ! -s $sync_err
28 test 3 -eq "$(wc -l < $sync_out)"
29 test 1 -eq "$(uniq < $sync_out | wc -l)"
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 "termination signal sent" && {
40 kill $rainbows_pid
43 t_begin "no errors in stderr" && check_stderr
45 t_done