Sha256: b1d15c84279cb794f9783b2283904dbe1662b51884d06685d779f6eb8c83d7b4

Contents?: true

Size: 1.3 KB

Versions: 129

Compression:

Stored size: 1.3 KB

Contents

#!/bin/sh
. ./test-lib.sh
t_plan 8 "SIGTTIN succeeds after SIGWINCH"

t_begin "setup and start" && {
	unicorn_setup
cat >> $unicorn_config <<EOF
after_fork do |server, worker|
  # test script will block while reading from $fifo,
  File.open("$fifo", "wb") { |fp| fp.syswrite worker.nr.to_s }
end
EOF
	unicorn -D -c $unicorn_config pid.ru
	unicorn_wait_start
	test 0 -eq $(cat $fifo) || die "worker.nr != 0"
}

t_begin "read worker pid" && {
	orig_worker_pid=$(curl -sSf http://$listen/)
	test -n "$orig_worker_pid" && kill -0 $orig_worker_pid
}

t_begin "stop all workers" && {
	kill -WINCH $unicorn_pid
}

# we have to do this next step before delivering TTIN
# signals aren't guaranteed to delivered in order
t_begin "wait for worker to die" && {
	i=0
	while kill -0 $orig_worker_pid 2>/dev/null
	do
		i=$(( $i + 1 ))
		test $i -lt 600 || die "timed out"
		sleep 1
	done
}

t_begin "start one worker back up" && {
	kill -TTIN $unicorn_pid
}

t_begin "wait for new worker to start" && {
	test 0 -eq $(cat $fifo) || die "worker.nr != 0"
	new_worker_pid=$(curl -sSf http://$listen/)
	test -n "$new_worker_pid" && kill -0 $new_worker_pid
	test $orig_worker_pid -ne $new_worker_pid || \
	   die "worker wasn't replaced"
}

t_begin "killing succeeds" && {
	kill $unicorn_pid
}

t_begin "check stderr" && check_stderr

dbgcat r_err

t_done

Version data entries

129 entries across 129 versions & 11 rubygems

Version Path
unicorn-6.1.0 t/t0009-winch_ttin.sh
unicorn-6.0.0 t/t0009-winch_ttin.sh
unicorn-5.8.0 t/t0009-winch_ttin.sh
unicorn-5.7.0 t/t0009-winch_ttin.sh
unicorn-5.6.0 t/t0009-winch_ttin.sh
unicorn-5.5.5 t/t0009-winch_ttin.sh
unicorn-5.5.4 t/t0009-winch_ttin.sh
unicorn-5.5.3 t/t0009-winch_ttin.sh
unicorn-5.5.2 t/t0009-winch_ttin.sh
unicorn-5.5.1 t/t0009-winch_ttin.sh
unicorn-5.5.0.1.g6836 t/t0009-winch_ttin.sh
unicorn-5.5.0 t/t0009-winch_ttin.sh
unicorn-5.5.0.pre1 t/t0009-winch_ttin.sh
unicorn-5.4.1 t/t0009-winch_ttin.sh
unicorn-5.4.0 t/t0009-winch_ttin.sh
unicorn-5.3.1 t/t0009-winch_ttin.sh
unicorn-shopify-5.3.0 t/t0009-winch_ttin.sh
unicorn-5.3.0 t/t0009-winch_ttin.sh
unicorn-5.3.0.pre1 t/t0009-winch_ttin.sh
unicorn-shopify-5.2.0.6 t/t0009-winch_ttin.sh