4 echo "$0 is broken under Rubinius for now"
9 t_plan
6 "config.ru inside alt working_directory"
11 t_begin
"setup and start" && {
13 rtmpfiles unicorn_config_tmp
17 cat > $t_pfx.app
/config.ru
<<EOF
18 #\--daemonize --listen $listen
19 use Rack::ContentLength
20 use Rack::ContentType, "text/plain"
21 run lambda { |env| [ 200, {}, [ "#{\$master_ppid}\\n" ] ] }
23 # we have --host/--port in config.ru instead
24 grep -v ^listen
$unicorn_config > $unicorn_config_tmp
26 # the whole point of this exercise
27 echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
29 # allows ppid to be 1 in before_fork
30 echo "preload_app true" >> $unicorn_config_tmp
31 cat >> $unicorn_config_tmp <<\EOF
32 before_fork
do |server
,worker|
33 $master_ppid = Process.ppid
# should be zero to detect daemonization
37 mv $unicorn_config_tmp $unicorn_config
39 # rely on --daemonize switch, no & or -D
40 rainbows
-c $unicorn_config
44 t_begin
"reload to avoid race condition" && {
45 curl
-sSf http
://$listen/ >/dev
/null
46 kill -HUP $rainbows_pid
47 test xSTART
= x
"$(cat $fifo)"
50 t_begin
"hit with curl" && {
51 body
=$
(curl
-sSf http
://$listen/)
54 t_begin
"killing succeeds" && {
58 t_begin
"response body ppid == 1 (daemonized)" && {
62 t_begin
"cleanup working directory" && {