unicorn 4.6.0pre1 - hijacking support
[unicorn.git] / t / t0009-broken-app.sh
blob895b17839c175044fd1e305b4b5abb1a044c2458
1 #!/bin/sh
2 . ./test-lib.sh
4 t_plan 9 "graceful handling of broken apps"
6 t_begin "setup and start" && {
7 unicorn_setup
8 unicorn -E none -D broken-app.ru -c $unicorn_config
9 unicorn_wait_start
12 t_begin "normal response is alright" && {
13 test xOK = x"$(curl -sSf http://$listen/)"
16 t_begin "app raised exception" && {
17 curl -sSf http://$listen/raise 2> $tmp || :
18 grep -F 500 $tmp
19 > $tmp
22 t_begin "app exception logged and backtrace not swallowed" && {
23 grep -F 'app error' $r_err
24 grep -A1 -F 'app error' $r_err | tail -1 | grep broken-app.ru:
25 dbgcat r_err
26 > $r_err
29 t_begin "trigger bad response" && {
30 curl -sSf http://$listen/nil 2> $tmp || :
31 grep -F 500 $tmp
32 > $tmp
35 t_begin "app exception logged" && {
36 grep -F 'app error' $r_err
37 > $r_err
40 t_begin "normal responses alright afterwards" && {
41 > $tmp
42 curl -sSf http://$listen/ >> $tmp &
43 curl -sSf http://$listen/ >> $tmp &
44 curl -sSf http://$listen/ >> $tmp &
45 curl -sSf http://$listen/ >> $tmp &
46 wait
47 test xOK = x$(sort < $tmp | uniq)
50 t_begin "teardown" && {
51 kill $unicorn_pid
54 t_begin "check stderr" && check_stderr
56 t_done