unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob 444f05acd03e7ec6cc96e4254ad3298851ade5b1 1251 bytes (raw)
$ git show maint:t/t0303-rails3-alt-working_directory_config.ru.sh	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
#!/bin/sh
if test -n "$RBX_SKIP"
then
	echo "$0 is broken under Rubinius for now"
	exit 0
fi
. ./test-rails3.sh

t_plan 5 "Rails 3 (beta) inside alt working_directory (w/ config.ru)"

t_begin "setup and start" && {
	unicorn_setup
	rtmpfiles unicorn_config_tmp usocket
	if test -e $usocket
	then
		die "unexpected $usocket"
	fi
	rails3_app=$(cd rails3-app && pwd)
	rm -rf $t_pfx.app
	mkdir $t_pfx.app
	cd $t_pfx.app
	( cd $rails3_app && tar cf - . ) | tar xf -
	$RAKE db:sessions:create
	$RAKE db:migrate
	unicorn_setup
	rm $pid

	echo "#\\--daemonize --host $host --port $port -l $usocket" \
	     >> $t_pfx.app/config.ru

	# we have --host/--port in config.ru instead
	grep -v ^listen $unicorn_config |
	  grep -v ^pid > $unicorn_config_tmp
	echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
	cd /
	unicorn_rails -c $unicorn_config_tmp
}

t_begin "pids in the right place" && {
	if test -e $pid
	then
		die "pid=$pid not expected"
	fi

	unicorn_rails_pid="$t_pfx.app/tmp/pids/unicorn.pid"
	unicorn_pid=$(cat $unicorn_rails_pid)
}

t_begin "static file serving works" && {
	test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
}

t_begin "socket created" && {
	test -S $usocket
}

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

t_done

git clone https://yhbt.net/unicorn.git