stream_input: read with zero length returns ''
[unicorn.git] / t / t0001-reload-bad-config.sh
blobe1393ae235ce30fe5ee288410bc277b2a2e0c94a
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 unicorn_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 unicorn -D -c $unicorn_config $ru
17 unicorn_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 $unicorn_pid
31 while ! egrep '(done|error) reloading' $r_err >/dev/null
33 sleep 1
34 done
36 grep 'error reloading' $r_err >/dev/null
39 t_begin "hit with curl" && {
40 out=$(curl -sSf http://$listen/)
41 test x"$out" = x'{"hello"=>"world"}'
44 t_begin "killing succeeds" && {
45 kill $unicorn_pid
48 t_begin "check stderr" && {
49 check_stderr
52 t_done