3 t_plan
8 "SIGTTIN succeeds after SIGWINCH"
5 t_begin
"setup and start" && {
7 cat >> $unicorn_config <<EOF
8 after_fork do |server, worker|
9 # test script will block while reading from $fifo,
10 File.open("$fifo", "wb") { |fp| fp.syswrite worker.nr.to_s }
13 unicorn
-D -c $unicorn_config pid.ru
15 test 0 -eq $
(cat $fifo) || die
"worker.nr != 0"
18 t_begin
"read worker pid" && {
19 orig_worker_pid
=$
(curl
-sSf http
://$listen/)
20 test -n "$orig_worker_pid" && kill -0 $orig_worker_pid
23 t_begin
"stop all workers" && {
24 kill -WINCH $unicorn_pid
27 # we have to do this next step before delivering TTIN
28 # signals aren't guaranteed to delivered in order
29 t_begin
"wait for worker to die" && {
31 while kill -0 $orig_worker_pid 2>/dev
/null
34 test $i -lt 600 || die
"timed out"
39 t_begin
"start one worker back up" && {
40 kill -TTIN $unicorn_pid
43 t_begin
"wait for new worker to start" && {
44 test 0 -eq $
(cat $fifo) || die
"worker.nr != 0"
45 new_worker_pid
=$
(curl
-sSf http
://$listen/)
46 test -n "$new_worker_pid" && kill -0 $new_worker_pid
47 test $orig_worker_pid -ne $new_worker_pid || \
48 die
"worker wasn't replaced"
51 t_begin
"killing succeeds" && {
55 t_begin
"check stderr" && check_stderr