tests: enable ActorSpawn test for rbx
[rainbows.git] / t / t0400-em-async-app.sh
blob34da2ad0b3970a7cac7a6ddaa6bbc1c157331e90
1 #!/bin/sh
2 nr=${nr-5}
3 . ./test-lib.sh
4 case $model in
5 NeverBlock|EventMachine) ;;
6 *)
7 t_info "skipping $T since it's not compatible with $model"
8 exit 0
9 ;;
10 esac
12 t_plan 7 "async_app test for test for EM"
14 CONFIG_RU=async_examples/async_app.ru
16 t_begin "setup and start" && {
17 rainbows_setup
18 rtmpfiles a b c curl_err expect
20 # this does not does not support Rack::Lint
21 rainbows -E deployment -D $CONFIG_RU -c $unicorn_config
22 rainbows_wait_start
25 t_begin "send async requests off in parallel" && {
26 t0=$(date +%s)
27 curl --no-buffer -sSf http://$listen/ > $a 2>> $curl_err &
28 curl --no-buffer -sSf http://$listen/ > $b 2>> $curl_err &
29 curl --no-buffer -sSf http://$listen/ > $c 2>> $curl_err &
32 t_begin "wait for curl terminations" && {
33 wait
34 t1=$(date +%s)
35 elapsed=$(( $t1 - $t0 ))
36 t_info "elapsed=$elapsed"
39 t_begin "termination signal sent" && {
40 kill $rainbows_pid
43 t_begin "no errors from curl" && {
44 test ! -s $curl_err
47 t_begin "no errors in stderr" && check_stderr
49 t_begin "responses match expected" && {
50 echo 'Woah, async!' > $expect
51 printf 'Cheers then!' >> $expect
52 cmp $expect $a
53 cmp $expect $b
54 cmp $expect $c
57 t_done