tests: avoid race conditions on reload tests
[rainbows.git] / t / t0013-reload-bad-config.sh
blob9e102097aa1cfdd71bd4861a7f0fc004701f095b
1 #!/bin/sh
2 . ./test-lib.sh
3 t_plan 7 "reload config.ru error with preload_app true"
5 t_begin "setup and start" && {
6 rainbows_setup
7 rtmpfiles ru
9 cat > $ru <<\EOF
10 use Rack::ContentLength
11 use Rack::ContentType, "text/plain"
12 x = { "hello" => "world" }
13 run lambda { |env| [ 200, {}, [ x.inspect << "\n" ] ] }
14 EOF
15 echo 'preload_app true' >> $unicorn_config
16 rainbows -D -c $unicorn_config $ru
17 rainbows_wait_start
20 t_begin "hit with curl" && {
21 out=$(curl -sSf http://$listen/)
22 test x"$out" = x'{"hello"=>"world"}'
25 t_begin "introduce syntax error in rackup file" && {
26 echo '...' >> $ru
29 t_begin "reload signal succeeds" && {
30 kill -HUP $rainbows_pid
31 rainbows_wait_start
32 wait_for_reload $r_err error
33 wait_for_reap
34 > $r_err
37 t_begin "hit with curl" && {
38 out=$(curl -sSf http://$listen/)
39 test x"$out" = x'{"hello"=>"world"}'
42 t_begin "killing succeeds" && {
43 kill $rainbows_pid
46 t_begin "check stderr" && {
47 check_stderr
50 t_done