4 t_plan
9 "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" && {
26 err
="$(curl -sSf http://$listen/block-forever 2>&1 || :)"
28 elapsed
=$
(($t1 - $t0))
29 t_info
"elapsed=$elapsed err=$err"
30 test x
"$err" != x
"Should never get here"
31 test x
"$err" != x
"$worker_pid"
34 t_begin
"ensure timeout took 3-6 seconds" && {
36 test $elapsed -le 6 # give it some slack in case box is bogged down
39 t_begin
"wait for new worker to start up" && {
40 test xSTART
= x
"$(cat $fifo)"
43 t_begin
"we get a fresh new worker process" && {
44 new_worker_pid
=$
(curl
-sSf http
://$listen/)
45 test $new_worker_pid -ne $worker_pid
48 t_begin
"SIGSTOP and SIGCONT on rainbows master does not kill worker" && {
49 kill -STOP $rainbows_pid
51 kill -CONT $rainbows_pid
53 test $new_worker_pid -eq $
(curl
-sSf http
://$listen/)
56 t_begin
"stop server" && {