diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-08-07 04:25:51 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-08-07 04:32:22 +0000 |
commit | e4d0b226391948ef433f1d0135814315e4c48535 (patch) | |
tree | f56b9fd5f2e196b68cfedf7fc0a39241b8e7d36a /t | |
parent | f1d33c80dd6c5650f960f7087f4e08f809754d34 (diff) | |
download | unicorn-e4d0b226391948ef433f1d0135814315e4c48535.tar.gz |
Something is wrong if workers exit with a non-zero status, so we'll increase the log level to help prevent people from missing it.
Diffstat (limited to 't')
-rwxr-xr-x | t/t0010-reap-logging.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/t/t0010-reap-logging.sh b/t/t0010-reap-logging.sh new file mode 100755 index 0000000..93d8c60 --- /dev/null +++ b/t/t0010-reap-logging.sh @@ -0,0 +1,55 @@ +#!/bin/sh +. ./test-lib.sh +t_plan 9 "reap worker logging messages" + +t_begin "setup and start" && { + unicorn_setup + cat >> $unicorn_config <<EOF +after_fork { |s,w| File.open('$fifo','w') { |f| f.write '.' } } +EOF + unicorn -c $unicorn_config pid.ru & + test '.' = $(cat $fifo) + unicorn_wait_start +} + +t_begin "kill 1st worker=0" && { + pid_1=$(curl http://$listen/) + kill -9 $pid_1 +} + +t_begin "wait for 2nd worker to start" && { + test '.' = $(cat $fifo) +} + +t_begin "ensure log of 1st reap is an ERROR" && { + dbgcat r_err + grep 'ERROR.*reaped.*worker=0' $r_err | grep $pid_1 + dbgcat r_err + > $r_err +} + +t_begin "kill 2nd worker gracefully" && { + pid_2=$(curl http://$listen/) + kill -QUIT $pid_2 +} + +t_begin "wait for 3rd worker=0 to start " && { + test '.' = $(cat $fifo) +} + +t_begin "ensure log of 2nd reap is a INFO" && { + grep 'INFO.*reaped.*worker=0' $r_err | grep $pid_2 + > $r_err +} + +t_begin "killing succeeds" && { + kill $unicorn_pid + wait + kill -0 $unicorn_pid && false +} + +t_begin "check stderr" && { + check_stderr +} + +t_done |