summaryrefslogtreecommitdiff
path: root/ctdb/tests/cunit/sock_daemon_test_001.sh
blob: e5bae38d3a0b36c97c4a65cb355cb0cc392dd9f2 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh

. "${TEST_SCRIPTS_DIR}/unit.sh"

pidfile="${TEST_VAR_DIR}/sock_daemon_test.pid.$$"
sockpath="${TEST_VAR_DIR}/sock_daemon_test.sock.$$"

remove_files ()
{
	rm -f "$pidfile"
	rm -f "$sockpath"
}

test_cleanup remove_files

result_filter ()
{
	_pid="[0-9][0-9]*"
	sed -e "s|pid=${_pid}|pid=PID|" \
	    -e "s|PID ${_pid}|PID PID|" \
	    -e "s|\[${_pid}\]|[PID]|"
}


ok <<EOF
test1[PID]: daemon started, pid=PID
test1[PID]: startup failed, ret=1
test1[PID]: daemon started, pid=PID
test1[PID]: startup failed, ret=2
test1[PID]: daemon started, pid=PID
test1[PID]: startup completed successfully
test1[PID]: listening on $sockpath
test1[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 1

ok <<EOF
test2[PID]: daemon started, pid=PID
test2[PID]: startup completed successfully
test2[PID]: listening on $sockpath
test2[PID]: Received signal 1
test2[PID]: reconfigure failed, ret=1
test2[PID]: Received signal 10
test2[PID]: reconfigure completed successfully
test2[PID]: Received signal 15
test2[PID]: Shutting down
test2[PID]: daemon started, pid=PID
test2[PID]: startup completed successfully
test2[PID]: listening on $sockpath
test2[PID]: Received signal 10
test2[PID]: reconfigure failed, ret=2
test2[PID]: Received signal 1
test2[PID]: reconfigure completed successfully
test2[PID]: Received signal 15
test2[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 2

ok <<EOF
test3[PID]: daemon started, pid=PID
test3[PID]: listening on $sockpath
test3[PID]: PID PID gone away, exiting
test3[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 3

ok <<EOF
test4[PID]: daemon started, pid=PID
test4[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 4

ok <<EOF
test5[PID]: daemon started, pid=PID
test5[PID]: listening on $sockpath
test5[PID]: Received signal 15
test5[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 5

ok <<EOF
test6[PID]: daemon started, pid=PID
test6[PID]: listening on $sockpath
test6[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 6

ok <<EOF
test7[PID]: daemon started, pid=PID
test7[PID]: startup completed successfully
test7[PID]: Received signal 15
test7[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 7

ok <<EOF
test8[PID]: daemon started, pid=PID
test8[PID]: startup completed successfully
test8[PID]: Received signal 15
test8[PID]: Shutting down
test8[PID]: daemon started, pid=PID
test8[PID]: startup completed successfully
test8[PID]: Received signal 15
test8[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 8

ok <<EOF
test9[PID]: daemon started, pid=PID
test9[PID]: startup completed successfully
test9[PID]: Received signal 15
test9[PID]: Shutting down
test9[PID]: daemon started, pid=PID
test9[PID]: startup completed successfully
test9[PID]: Received signal 15
test9[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 9

ok <<EOF
test10[PID]: daemon started, pid=PID
test10[PID]: listening on $sockpath
test10[PID]: daemon started, pid=PID
test10[PID]: listening on $sockpath
test10[PID]: Received signal 15
test10[PID]: Shutting down
EOF
unit_test sock_daemon_test "$pidfile" "$sockpath" 10