3 t_plan
7 "ensure worker follows master to death"
6 rtmpfiles curl_err curl_out
8 echo timeout
3 >> $unicorn_config
9 rainbows
-D -c $unicorn_config worker-follows-master-to-death.ru
13 t_begin
"read worker PID" && {
14 worker_pid
=$
(curl
-sSf http
://$listen/pid
)
15 t_info
"worker_pid=$worker_pid"
18 t_begin
"start a long sleeping request" && {
19 curl
-sSfv -T- </dev
/null http
://$listen/sleep
/2 >$curl_out 2> $fifo &
21 t_info
"curl_pid=$curl_pid"
24 t_begin
"nuke the master once we're connected" && {
25 awk -v rainbows_pid
=$rainbows_pid '
28 print "awk: sending SIGKILL to", rainbows_pid
29 system("kill -9 "rainbows_pid)
30 }' < $fifo > $curl_err
34 t_begin
"worker is no longer running" && {
36 while kill -0 $worker_pid 2>/dev
/null
&& test $nr -gt 0
41 kill -0 $worker_pid 2> $tmp && false
45 t_begin
"sleepy curl request is no longer running" && {
46 kill -0 $curl_pid 2> $tmp && false
50 t_begin
"sleepy curl request completed gracefully" && {
51 test x$
(cat $curl_out) = x
$worker_pid