diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-11-26 14:09:45 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-11-26 14:19:04 -0800 |
commit | 5868eeecb2fbc85f3e4fabf3d16f27d259491c0d (patch) | |
tree | 21746be61158f9c177bc8e2600d7922cdedc7ce1 /t/t0009-broken-app.sh | |
parent | 278d9d5a7f3d2dc3c6563af1584b5e773e08073d (diff) | |
download | rainbows-5868eeecb2fbc85f3e4fabf3d16f27d259491c0d.tar.gz |
Make sure app errors get logged correctly, and we no longer return a 500 response when a client EOFs the write end (but not the read end) of a connection.
Diffstat (limited to 't/t0009-broken-app.sh')
-rw-r--r-- | t/t0009-broken-app.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/t/t0009-broken-app.sh b/t/t0009-broken-app.sh new file mode 100644 index 0000000..b5aae4e --- /dev/null +++ b/t/t0009-broken-app.sh @@ -0,0 +1,56 @@ +#!/bin/sh +. ./test-lib.sh + +t_plan 9 "graceful handling of broken apps for $model" + +t_begin "setup and start" && { + rainbows_setup + rainbows -D t0009.ru -c $unicorn_config $model 1 + rainbows_wait_start +} + +t_begin "normal response is alright" && { + test xOK = x"$(curl -sSf http://$listen/)" +} + +t_begin "app raised exception" && { + curl -sSf http://$listen/raise 2> $tmp || : + grep -F 500 $tmp + > $tmp +} + +t_begin "app exception logged and backtrace not swallowed" && { + grep -F 'app error' $r_err + grep -A1 -F 'app error' $r_err | tail -1 | grep t0009.ru: + dbgcat r_err + > $r_err +} + +t_begin "trigger bad response" && { + curl -sSf http://$listen/nil 2> $tmp || : + grep -F 500 $tmp + > $tmp +} + +t_begin "app exception logged" && { + grep -F 'app error' $r_err + > $r_err +} + +t_begin "normal responses alright afterwards" && { + > $tmp + curl -sSf http://$listen/ >> $tmp & + curl -sSf http://$listen/ >> $tmp & + curl -sSf http://$listen/ >> $tmp & + curl -sSf http://$listen/ >> $tmp & + wait + test xOK = x$(sort < $tmp | uniq) +} + +t_begin "teardown" && { + kill $rainbows_pid +} + +t_begin "check stderr" && check_stderr + +t_done |