http_server: kill a warning
[rainbows.git] / t / t0200-async-response.sh
blob16e1f76cba8740a4ab5f1be12cd706b8b5ee1544
1 #!/bin/sh
2 CONFIG_RU=${CONFIG_RU-'async-response.ru'}
3 . ./test-lib.sh
5 skip_models Base WriterThreadPool WriterThreadSpawn
7 case $CONFIG_RU in
8 *no-autochunk.ru)
9 t_plan 7 "async response w/o autochunk for $model"
10 skip_autochunk=true
13 t_plan 6 "async response for $model"
14 skip_autochunk=false
16 esac
18 t_begin "setup and start" && {
19 rainbows_setup
20 rtmpfiles a b c curl_err
21 # can't load Rack::Lint here since it'll cause Rev to slurp
22 rainbows -E none -D $CONFIG_RU -c $unicorn_config
23 rainbows_wait_start
26 t_begin "send async requests off in parallel" && {
27 t0=$(date +%s)
28 ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
29 ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
30 ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
31 wait
32 t1=$(date +%s)
35 t_begin "ensure elapsed requests were processed in parallel" && {
36 elapsed=$(( $t1 - $t0 ))
37 echo "elapsed=$elapsed < 30"
38 test $elapsed -lt 30
41 t_begin "termination signal sent" && {
42 kill $rainbows_pid
45 dbgcat a
46 dbgcat b
47 dbgcat c
48 dbgcat r_err
49 dbgcat curl_err
51 t_begin "no errors from curl" && {
52 test ! -s $curl_err
55 t_begin "no errors in stderr" && check_stderr
57 dbgcat r_err
59 if $skip_autochunk
60 then
61 t_begin "no responses are chunked" && {
62 test x"$(cat $a)" = x0123456789
63 test x"$(cat $b)" = x0123456789
64 test x"$(cat $c)" = x0123456789
68 t_done