Sha256: cfdaf55722aeb3ab81c192cebab31e7aea7c923faa0aa796b1c3505949f7808d

Contents?: true

Size: 1.07 KB

Versions: 99

Compression:

Stored size: 1.07 KB

Contents

#!/bin/sh
. ./test-lib.sh

t_plan 5 "at_exit/END handlers work as expected"

t_begin "setup and startup" && {
	unicorn_setup
	cat >> $unicorn_config <<EOF
at_exit { \$stdout.syswrite("#{Process.pid} BOTH\\n") }
END { \$stdout.syswrite("#{Process.pid} END BOTH\\n") }
after_fork do |_,_|
  at_exit { \$stdout.syswrite("#{Process.pid} WORKER ONLY\\n") }
  END { \$stdout.syswrite("#{Process.pid} END WORKER ONLY\\n") }
end
EOF

	unicorn -D pid.ru -c $unicorn_config
	unicorn_wait_start
}

t_begin "read worker PID" && {
	worker_pid=$(curl -sSf http://$listen/)
	t_info "worker_pid=$worker_pid"
}

t_begin "issue graceful shutdown (SIGQUIT) and wait for termination" && {
	kill -QUIT $unicorn_pid

	while kill -0 $unicorn_pid >/dev/null 2>&1
	do
		sleep 1
	done
}

t_begin "check stderr" && check_stderr

dbgcat r_err
dbgcat r_out

t_begin "all at_exit handlers ran" && {
	grep "$worker_pid BOTH" $r_out
	grep "$unicorn_pid BOTH" $r_out
	grep "$worker_pid END BOTH" $r_out
	grep "$unicorn_pid END BOTH" $r_out
	grep "$worker_pid WORKER ONLY" $r_out
	grep "$worker_pid END WORKER ONLY" $r_out
}

t_done

Version data entries

99 entries across 99 versions & 11 rubygems

Version Path
unicorn-maintained-6.2.0 t/t0020-at_exit-handler.sh
unicorn-6.1.0 t/t0020-at_exit-handler.sh
unicorn-6.0.0 t/t0020-at_exit-handler.sh
unicorn-5.8.0 t/t0020-at_exit-handler.sh
unicorn-5.7.0 t/t0020-at_exit-handler.sh
unicorn-5.6.0 t/t0020-at_exit-handler.sh
unicorn-5.5.5 t/t0020-at_exit-handler.sh
unicorn-5.5.4 t/t0020-at_exit-handler.sh
unicorn-5.5.3 t/t0020-at_exit-handler.sh
unicorn-5.5.2 t/t0020-at_exit-handler.sh
unicorn-5.5.1 t/t0020-at_exit-handler.sh
unicorn-5.5.0.1.g6836 t/t0020-at_exit-handler.sh
unicorn-5.5.0 t/t0020-at_exit-handler.sh
unicorn-5.5.0.pre1 t/t0020-at_exit-handler.sh
unicorn-5.4.1 t/t0020-at_exit-handler.sh
unicorn-5.4.0 t/t0020-at_exit-handler.sh
unicorn-5.3.1 t/t0020-at_exit-handler.sh
unicorn-shopify-5.3.0 t/t0020-at_exit-handler.sh
unicorn-5.3.0 t/t0020-at_exit-handler.sh
unicorn-5.3.0.pre1 t/t0020-at_exit-handler.sh