Sha256: 4af0481385503caa34819c17deab5c4769b8c62a8f8d5c07986a84f73c5b71ea

Contents?: true

Size: 925 Bytes

Versions: 134

Compression:

Stored size: 925 Bytes

Contents

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

t_plan 4 "config.ru inside alt working_directory (no embedded switches)"

t_begin "setup and start" && {
	unicorn_setup
	rm -rf $t_pfx.app
	mkdir $t_pfx.app

	cat > $t_pfx.app/config.ru <<EOF
use Rack::ContentLength
use Rack::ContentType, "text/plain"
run lambda { |env| [ 200, {}, [ "#{\$master_ppid}\\n" ] ] }
EOF
	# the whole point of this exercise
	echo "working_directory '$t_pfx.app'" >> $unicorn_config

	# allows ppid to be 1 in before_fork
	echo "preload_app true" >> $unicorn_config
	cat >> $unicorn_config <<\EOF
before_fork do |server,worker|
  $master_ppid = Process.ppid # should be zero to detect daemonization
end
EOF

	cd /
	unicorn -D -c $unicorn_config
	unicorn_wait_start
}

t_begin "hit with curl" && {
	body=$(curl -sSf http://$listen/)
}

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

t_begin "response body ppid == 1 (daemonized)" && {
	test "$body" -eq 1
}

t_done

Version data entries

134 entries across 134 versions & 11 rubygems

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