about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-05-20 03:40:49 -0700
committerEric Wong <normalperson@yhbt.net>2010-05-20 03:40:49 -0700
commitac92728df5a673076e3fedd1436cef7c24e534b5 (patch)
treeadae0839058358547df6268c02dd1ddb0aa9e9cb /t
parentd1b2756e6a5b7b9e1c47861f230ec9effe6ca382 (diff)
downloadrainbows-ac92728df5a673076e3fedd1436cef7c24e534b5.tar.gz
since we don't set maximum time boundaries, just rely on
the logs to properly log the dead processes.
Diffstat (limited to 't')
-rwxr-xr-xt/t0004-heartbeat-timeout.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/t/t0004-heartbeat-timeout.sh b/t/t0004-heartbeat-timeout.sh
index faabd1f..5010875 100755
--- a/t/t0004-heartbeat-timeout.sh
+++ b/t/t0004-heartbeat-timeout.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 . ./test-lib.sh
 
-t_plan 9 "heartbeat/timeout test for $model"
+t_plan 12 "heartbeat/timeout test for $model"
 
 t_begin "setup and startup" && {
         rainbows_setup $model
@@ -22,8 +22,9 @@ t_begin "sleep for a bit, ensure worker PID does not change" && {
 }
 
 t_begin "block the worker process to force it to die" && {
+        rm $ok
         t0=$(date +%s)
-        err="$(curl -sSf http://$listen/block-forever 2>&1 || :)"
+        err="$(curl -sSf http://$listen/block-forever 2>&1 || > $ok)"
         t1=$(date +%s)
         elapsed=$(($t1 - $t0))
         t_info "elapsed=$elapsed err=$err"
@@ -31,6 +32,11 @@ t_begin "block the worker process to force it to die" && {
         test x"$err" != x"$worker_pid"
 }
 
+t_begin "ensure worker was killed" && {
+        test -e $ok
+        test 1 -eq $(grep timeout $r_err | grep killing | wc -l)
+}
+
 t_begin "ensure timeout took at least 3 seconds" && {
         test $elapsed -ge 3
 }
@@ -44,6 +50,10 @@ t_begin "we get a fresh new worker process" && {
         test $new_worker_pid -ne $worker_pid
 }
 
+t_begin "truncate the server error log" && {
+        > $r_err
+}
+
 t_begin "SIGSTOP and SIGCONT on rainbows master does not kill worker" && {
         kill -STOP $rainbows_pid
         sleep 4
@@ -53,9 +63,11 @@ t_begin "SIGSTOP and SIGCONT on rainbows master does not kill worker" && {
 }
 
 t_begin "stop server" && {
-        kill $rainbows_pid
+        kill -QUIT $rainbows_pid
 }
 
+t_begin "check stderr" && check_stderr
+
 dbgcat r_err
 
 t_done