blob 6f9ac53e921d31e06c2309a3573acc7590faceca 1641 bytes (raw)
name: t/t0011-active-unix-socket.sh # note: path name is non-authoritative(*)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
| | #!/bin/sh
. ./test-lib.sh
t_plan 11 "existing UNIX domain socket check"
read_pid_unix () {
x=$(printf 'GET / HTTP/1.0\r\n\r\n' | \
socat - UNIX:$unix_socket | \
tail -1)
test -n "$x"
y="$(expr "$x" : '\([0-9]\+\)')"
test x"$x" = x"$y"
test -n "$y"
echo "$y"
}
t_begin "setup and start" && {
rtmpfiles unix_socket unix_config
rm -f $unix_socket
unicorn_setup
grep -v ^listen < $unicorn_config > $unix_config
echo "listen '$unix_socket'" >> $unix_config
unicorn -D -c $unix_config pid.ru
unicorn_wait_start
orig_master_pid=$unicorn_pid
}
t_begin "get pid of worker" && {
worker_pid=$(read_pid_unix)
t_info "worker_pid=$worker_pid"
}
t_begin "fails to start with existing pid file" && {
rm -f $ok
unicorn -D -c $unix_config pid.ru || echo ok > $ok
test x"$(cat $ok)" = xok
}
t_begin "worker pid unchanged" && {
test x"$(read_pid_unix)" = x$worker_pid
> $r_err
}
t_begin "fails to start with listening UNIX domain socket bound" && {
rm $ok $pid
unicorn -D -c $unix_config pid.ru || echo ok > $ok
test x"$(cat $ok)" = xok
> $r_err
}
t_begin "worker pid unchanged (again)" && {
test x"$(read_pid_unix)" = x$worker_pid
}
t_begin "nuking the existing Unicorn succeeds" && {
kill -9 $unicorn_pid $worker_pid
while kill -0 $unicorn_pid
do
sleep 1
done
check_stderr
}
t_begin "succeeds in starting with leftover UNIX domain socket bound" && {
test -S $unix_socket
unicorn -D -c $unix_config pid.ru
unicorn_wait_start
}
t_begin "worker pid changed" && {
test x"$(read_pid_unix)" != x$worker_pid
}
t_begin "killing succeeds" && {
kill $unicorn_pid
}
t_begin "no errors" && check_stderr
t_done
|
debug log:
solving 6f9ac53 ...
found 6f9ac53 in https://yhbt.net/unicorn.git/
(*) Git path names are given by the tree(s) the blob belongs to.
Blobs themselves have no identifier aside from the hash of its contents.^
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).