4 t_plan
12 "heartbeat/timeout test for $model"
6 t_begin
"setup and startup" && {
8 echo timeout
3 >> $unicorn_config
9 echo preload_app true
>> $unicorn_config
10 rainbows
-D heartbeat-timeout.ru
-c $unicorn_config
14 t_begin
"read worker PID" && {
15 worker_pid
=$
(curl
-sSf http
://$listen/)
16 t_info
"worker_pid=$worker_pid"
19 t_begin
"sleep for a bit, ensure worker PID does not change" && {
21 test $
(curl
-sSf http
://$listen/) -eq $worker_pid
24 t_begin
"block the worker process to force it to die" && {
27 err
="$(curl -sSf http://$listen/block-forever 2>&1 || > $ok)"
29 elapsed
=$
(($t1 - $t0))
30 t_info
"elapsed=$elapsed err=$err"
31 test x
"$err" != x
"Should never get here"
32 test x
"$err" != x
"$worker_pid"
35 t_begin
"ensure worker was killed" && {
37 test 1 -eq $
(grep timeout
$r_err |
grep killing |
wc -l)
40 t_begin
"ensure timeout took at least 3 seconds" && {
44 t_begin
"wait for new worker to start up" && {
45 test xSTART
= x
"$(cat $fifo)"
48 t_begin
"we get a fresh new worker process" && {
49 new_worker_pid
=$
(curl
-sSf http
://$listen/)
50 test $new_worker_pid -ne $worker_pid
53 t_begin
"truncate the server error log" && {
57 t_begin
"SIGSTOP and SIGCONT on rainbows master does not kill worker" && {
58 kill -STOP $rainbows_pid
60 kill -CONT $rainbows_pid
62 test $new_worker_pid -eq $
(curl
-sSf http
://$listen/)
65 t_begin
"stop server" && {
66 kill -QUIT $rainbows_pid
69 t_begin
"check stderr" && check_stderr