diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-12-30 01:27:15 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-12-30 01:53:46 -0800 |
commit | 96fbc5e91017c4912169629abc7dbb56cda9082c (patch) | |
tree | 763cc51001ef8459e8e65b315740701b15a2b48d /t/t0400-em-async-app.sh | |
parent | 44a80df0c4c0d47fd2ac503396cb9accfe770f0a (diff) | |
download | rainbows-96fbc5e91017c4912169629abc7dbb56cda9082c.tar.gz |
Some async apps rely on more than just "async.callback" and make full use of Deferrables provided by the EM::Deferrable module. Thanks to James Tucker for bringing this to our attention.
Diffstat (limited to 't/t0400-em-async-app.sh')
-rwxr-xr-x | t/t0400-em-async-app.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/t/t0400-em-async-app.sh b/t/t0400-em-async-app.sh new file mode 100755 index 0000000..34da2ad --- /dev/null +++ b/t/t0400-em-async-app.sh @@ -0,0 +1,57 @@ +#!/bin/sh +nr=${nr-5} +. ./test-lib.sh +case $model in +NeverBlock|EventMachine) ;; +*) + t_info "skipping $T since it's not compatible with $model" + exit 0 + ;; +esac + +t_plan 7 "async_app test for test for EM" + +CONFIG_RU=async_examples/async_app.ru + +t_begin "setup and start" && { + rainbows_setup + rtmpfiles a b c curl_err expect + + # this does not does not support Rack::Lint + rainbows -E deployment -D $CONFIG_RU -c $unicorn_config + rainbows_wait_start +} + +t_begin "send async requests off in parallel" && { + t0=$(date +%s) + curl --no-buffer -sSf http://$listen/ > $a 2>> $curl_err & + curl --no-buffer -sSf http://$listen/ > $b 2>> $curl_err & + curl --no-buffer -sSf http://$listen/ > $c 2>> $curl_err & +} + +t_begin "wait for curl terminations" && { + wait + t1=$(date +%s) + elapsed=$(( $t1 - $t0 )) + t_info "elapsed=$elapsed" +} + +t_begin "termination signal sent" && { + kill $rainbows_pid +} + +t_begin "no errors from curl" && { + test ! -s $curl_err +} + +t_begin "no errors in stderr" && check_stderr + +t_begin "responses match expected" && { + echo 'Woah, async!' > $expect + printf 'Cheers then!' >> $expect + cmp $expect $a + cmp $expect $b + cmp $expect $c +} + +t_done |