4 t_plan
4 "config.ru inside alt working_directory (no embedded switches)"
6 t_begin
"setup and start" && {
11 cat > $t_pfx.app
/config.ru
<<EOF
12 use Rack::ContentLength
13 use Rack::ContentType, "text/plain"
14 run lambda { |env| [ 200, {}, [ "#{\$master_ppid}\\n" ] ] }
16 # the whole point of this exercise
17 echo "working_directory '$t_pfx.app'" >> $unicorn_config
19 # allows ppid to be 1 in before_fork
20 echo "preload_app true" >> $unicorn_config
21 cat >> $unicorn_config <<\EOF
22 before_fork
do |server
,worker|
23 $master_ppid = Process.ppid
# should be zero to detect daemonization
28 unicorn
-D -c $unicorn_config
32 t_begin
"hit with curl" && {
33 body
=$
(curl
-sSf http
://$listen/)
36 t_begin
"killing succeeds" && {
40 t_begin
"response body ppid == 1 (daemonized)" && {