4 NeverBlock|EventMachine
) ;;
6 t_info
"skipping $T since it's not compatible with $model"
11 t_plan
9 "async_chunk_app test for test for EM"
13 CONFIG_RU
=async_chunk_app.ru
15 t_begin
"setup and start" && {
17 rtmpfiles a b c curl_err expect
19 # this does not does not support Rack::Lint
20 rainbows
-E none
-D $CONFIG_RU -c $unicorn_config
23 echo 'Hello World /0' >> $expect
24 echo 'Hello World /1' >> $expect
25 echo 'Hello World /2' >> $expect
28 t_begin
"async.callback supports pipelining" && {
33 printf 'GET /0 HTTP/1.1\r\nHost: example.com\r\n\r\n'
34 printf 'GET /1 HTTP/1.1\r\nHost: example.com\r\n\r\n'
35 printf 'GET /2 HTTP/1.0\r\nHost: example.com\r\n\r\n'
37 ) | socat
- TCP
:$listen > $fifo
39 elapsed
=$
(( $t1 - $t0 ))
40 t_info
"elapsed=$elapsed $model.$0 ($t_current)"
41 test 3 -eq "$(fgrep 'HTTP/1.1 200 OK' $tmp | wc -l)"
44 t_begin
"async.callback supports keepalive" && {
46 curl
-v --no-buffer -sSf http
://$listen/[0-2] > $tmp 2>> $curl_err
48 elapsed
=$
(( $t1 - $t0 ))
49 t_info
"elapsed=$elapsed $model.$0 ($t_current)"
51 test 2 -eq "$(fgrep 'Re-using existing connection!' $curl_err |wc -l)"
55 t_begin
"send async requests off in parallel" && {
57 curl
--no-buffer -sSf http
://$listen/[0-2] > $a 2>> $curl_err &
58 curl
--no-buffer -sSf http
://$listen/[0-2] > $b 2>> $curl_err &
59 curl
--no-buffer -sSf http
://$listen/[0-2] > $c 2>> $curl_err &
62 t_begin
"wait for curl terminations" && {
65 elapsed
=$
(( $t1 - $t0 ))
66 t_info
"elapsed=$elapsed"
69 t_begin
"termination signal sent" && {
73 t_begin
"no errors from curl" && {
77 t_begin
"no errors in stderr" && check_stderr
79 t_begin
"responses match expected" && {