ctdb-server: Use find_public_ip_vnn() in a couple of extra places
[samba4-gss.git] / ctdb / tests / UNIT / cunit / tmon_test_001.sh
blob96f706c2415ed13218bb34f2a05b9515c452414a
1 #!/bin/sh
3 . "${TEST_SCRIPTS_DIR}/unit.sh"
5 epipe=$(errcode EPIPE)
6 eio=$(errcode EIO)
7 etimedout=$(errcode ETIMEDOUT)
9 test_case "No pings, only child monitors, so gets EPIPE"
10 ok <<EOF
11 parent: async wait start 5
12 child: async wait start 10
13 parent: async wait end
14 child: pipe closed
15 EOF
16 unit_test tmon_ping_test false 0 5 0 0 false 0 10 0 "$epipe"
18 test_case "No pings, only parent monitors, so gets EPIPE"
19 ok <<EOF
20 parent: async wait start 10
21 child: async wait start 5
22 child: async wait end
23 parent: pipe closed
24 EOF
25 unit_test tmon_ping_test false 0 10 0 "$epipe" false 0 5 0 0
27 test_case "No pings, Child exits first, parent notices"
28 ok <<EOF
29 parent: async wait start 10
30 child: async wait start 1
31 child: async wait end
32 parent: pipe closed
33 EOF
34 unit_test tmon_ping_test false 0 10 0 "$epipe" false 0 1 0 0
36 test_case "No pings, parent exits first, child notices"
37 ok <<EOF
38 parent: async wait start 1
39 child: async wait start 10
40 parent: async wait end
41 child: pipe closed
42 EOF
43 unit_test tmon_ping_test false 0 1 0 0 false 0 10 0 "$epipe"
45 test_case "Parent pings, child doesn't expect them, EIO"
46 ok <<EOF
47 parent: async wait start 5
48 child: async wait start 5
49 child: error ($eio)
50 parent: pipe closed
51 EOF
52 unit_test tmon_ping_test true 0 5 0 "$epipe" false 0 5 0 "$eio"
54 test_case "Child pings, parent doesn't expect them, EIO"
55 ok <<EOF
56 parent: async wait start 5
57 child: async wait start 5
58 parent: error ($eio)
59 child: pipe closed
60 EOF
61 unit_test tmon_ping_test false 0 5 0 "$eio" true 0 5 0 "$epipe"
63 test_case "Both ping, child doesn't expect them, EIO"
64 ok <<EOF
65 parent: async wait start 5
66 child: async wait start 5
67 child: error ($eio)
68 parent: pipe closed
69 EOF
70 unit_test tmon_ping_test true 3 5 0 "$epipe" true 0 5 0 "$eio"
72 test_case "Both ping, parent doesn't expect them, EIO"
73 ok <<EOF
74 parent: async wait start 5
75 child: async wait start 5
76 parent: error ($eio)
77 child: pipe closed
78 EOF
79 unit_test tmon_ping_test true 0 5 0 "$eio" true 3 5 0 "$epipe"
81 test_case "Child pings, no ping timeout error, child exits first"
82 ok <<EOF
83 parent: async wait start 10
84 child: async wait start 5
85 child: async wait end
86 parent: pipe closed
87 EOF
88 unit_test tmon_ping_test false 3 10 0 "$epipe" true 0 5 0 0
90 test_case "Parent pings, no ping timeout error, parent exits first"
91 ok <<EOF
92 parent: async wait start 5
93 child: async wait start 10
94 parent: async wait end
95 child: pipe closed
96 EOF
97 unit_test tmon_ping_test true 0 5 0 0 false 3 10 0 "$epipe"
99 test_case "Both ping, no ping timeout error, parent exits first"
100 ok <<EOF
101 parent: async wait start 5
102 child: async wait start 10
103 parent: async wait end
104 child: pipe closed
106 unit_test tmon_ping_test true 3 5 0 0 true 3 10 0 "$epipe"
108 test_case "Both ping, no ping timeout error, child exits first"
109 ok <<EOF
110 parent: async wait start 10
111 child: async wait start 5
112 child: async wait end
113 parent: pipe closed
115 unit_test tmon_ping_test true 3 10 0 "$epipe" true 3 5 0 0
117 test_case "Both ping, child blocks, parent ping timeout error"
118 ok <<EOF
119 parent: async wait start 20
120 child: blocking sleep start 7
121 parent: ping timeout
122 child: blocking sleep end
124 unit_test tmon_ping_test true 3 20 0 "$etimedout" true 3 0 7 0
126 test_case "Both ping, parent blocks, child ping timeout error"
127 ok <<EOF
128 parent: blocking sleep start 7
129 child: async wait start 20
130 child: ping timeout
131 parent: blocking sleep end
133 unit_test tmon_ping_test true 3 0 7 0 true 3 20 0 "$etimedout"
135 test_case "Both ping, child waits, child blocks, parent ping timeout error"
136 ok <<EOF
137 parent: async wait start 20
138 child: async wait start 2
139 child: async wait end
140 child: blocking sleep start 7
141 parent: ping timeout
142 child: blocking sleep end
144 unit_test tmon_ping_test true 3 20 0 "$etimedout" true 3 2 7 0
146 test_case "Both ping, parent waits, parent blocks, child ping timeout error"
147 ok <<EOF
148 parent: async wait start 2
149 child: async wait start 20
150 parent: async wait end
151 parent: blocking sleep start 7
152 child: ping timeout
153 parent: blocking sleep end
155 unit_test tmon_ping_test true 3 2 7 0 true 3 20 0 "$etimedout"
157 test_case "Both ping, child blocks for less than ping timeout"
158 ok <<EOF
159 parent: async wait start 20
160 child: blocking sleep start 3
161 child: blocking sleep end
162 parent: pipe closed
164 unit_test tmon_ping_test true 7 20 0 "$epipe" true 7 0 3 0
166 test_case "Both ping, parent blocks for less than ping timeout"
167 ok <<EOF
168 parent: blocking sleep start 3
169 child: async wait start 20
170 parent: blocking sleep end
171 child: pipe closed
173 unit_test tmon_ping_test true 7 0 3 0 true 7 20 3 "$epipe"
175 test_case "Both ping, child waits, child blocks for less than ping timeout"
176 ok <<EOF
177 parent: async wait start 20
178 child: async wait start 2
179 child: async wait end
180 child: blocking sleep start 3
181 child: blocking sleep end
182 parent: pipe closed
184 unit_test tmon_ping_test true 7 20 0 "$epipe" true 7 2 3 0
186 test_case "Both ping, parent waits, parent blocks for less than ping timeout"
187 ok <<EOF
188 parent: async wait start 2
189 child: async wait start 20
190 parent: async wait end
191 parent: blocking sleep start 3
192 parent: blocking sleep end
193 child: pipe closed
195 unit_test tmon_ping_test true 7 2 3 0 true 7 20 0 "$epipe"