tests.sh 18.4 KB
Newer Older
1
2
#!/bin/sh
#
3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4
5
6
7
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
10
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
11
12
13

SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
14

15
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
16

17
18
19
status=0
n=0

20
#echo_i "check ans.pl server ($n)"
21
22
23
24
25
26
27
28
29
30
31
32
#$DIG -p ${PORT} @10.53.0.2 example NS
#$DIG -p ${PORT} @10.53.0.2 example SOA
#$DIG -p ${PORT} @10.53.0.2 ns.example A
#$DIG -p ${PORT} @10.53.0.2 ns.example AAAA
#$DIG -p ${PORT} @10.53.0.2 txt enable
#$DIG -p ${PORT} @10.53.0.2 txt disable
#$DIG -p ${PORT} @10.53.0.2 ns.example AAAA
#$DIG -p ${PORT} @10.53.0.2 txt enable
#$DIG -p ${PORT} @10.53.0.2 ns.example AAAA
##$DIG -p ${PORT} @10.53.0.2 data.example TXT
#$DIG -p ${PORT} @10.53.0.2 nodata.example TXT
#$DIG -p ${PORT} @10.53.0.2 nxdomain.example TXT
33
34

n=`expr $n + 1`
35
echo_i "prime cache data.example ($n)"
36
ret=0
37
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
38
39
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
40
if [ $ret != 0 ]; then echo_i "failed"; fi
41
42
43
status=`expr $status + $ret`

n=`expr $n + 1`
44
echo_i "prime cache nodata.example ($n)"
45
ret=0
46
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
47
48
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
49
if [ $ret != 0 ]; then echo_i "failed"; fi
50
51
52
status=`expr $status + $ret`

n=`expr $n + 1`
53
echo_i "prime cache nxdomain.example ($n)"
54
ret=0
55
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
56
57
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
58
if [ $ret != 0 ]; then echo_i "failed"; fi
59
60
61
status=`expr $status + $ret`

n=`expr $n + 1`
62
echo_i "disable responses from authoritative server ($n)"
63
ret=0
64
$DIG -p ${PORT} @10.53.0.2 txt disable  > dig.out.test$n
65
66
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1
67
if [ $ret != 0 ]; then echo_i "failed"; fi
68
69
70
71
72
status=`expr $status + $ret`

sleep 1

n=`expr $n + 1`
73
echo_i "check 'rndc serve-stale status' ($n)"
74
75
76
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: on (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1
77
if [ $ret != 0 ]; then echo_i "failed"; fi
78
79
80
status=`expr $status + $ret`

n=`expr $n + 1`
81
echo_i "check stale data.example ($n)"
82
ret=0
83
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
84
85
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
86
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
87
if [ $ret != 0 ]; then echo_i "failed"; fi
88
89
90
status=`expr $status + $ret`

n=`expr $n + 1`
91
echo_i "check stale nodata.example ($n)"
92
ret=0
93
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
94
95
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
96
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
97
if [ $ret != 0 ]; then echo_i "failed"; fi
98
99
100
status=`expr $status + $ret`

n=`expr $n + 1`
101
echo_i "check stale nxdomain.example ($n)"
102
ret=0
103
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
104
105
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
106
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
107
if [ $ret != 0 ]; then echo_i "failed"; fi
108
109
110
status=`expr $status + $ret`

n=`expr $n + 1`
111
echo_i "running 'rndc serve-stale off' ($n)"
112
113
ret=0
$RNDCCMD 10.53.0.1 serve-stale off || ret=1
114
if [ $ret != 0 ]; then echo_i "failed"; fi
115
116
117
status=`expr $status + $ret`

n=`expr $n + 1`
118
echo_i "check 'rndc serve-stale status' ($n)"
119
120
121
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: off (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1
122
if [ $ret != 0 ]; then echo_i "failed"; fi
123
124
125
status=`expr $status + $ret`

n=`expr $n + 1`
126
echo_i "check stale data.example (serve-stale off) ($n)"
127
ret=0
128
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
129
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
130
if [ $ret != 0 ]; then echo_i "failed"; fi
131
status=`expr $status + $ret`
132
if [ $ret != 0 ]; then echo_i "failed"; fi
133
134
135
status=`expr $status + $ret`

n=`expr $n + 1`
136
echo_i "check stale nodata.example (serve-stale off) ($n)"
137
ret=0
138
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
139
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
140
if [ $ret != 0 ]; then echo_i "failed"; fi
141
142
143
status=`expr $status + $ret`

n=`expr $n + 1`
144
echo_i "check stale nxdomain.example (serve-stale off) ($n)"
145
ret=0
146
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
147
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
148
if [ $ret != 0 ]; then echo_i "failed"; fi
149
150
151
status=`expr $status + $ret`

n=`expr $n + 1`
152
echo_i "running 'rndc serve-stale on' ($n)"
153
154
ret=0
$RNDCCMD 10.53.0.1 serve-stale on || ret=1
155
if [ $ret != 0 ]; then echo_i "failed"; fi
156
157
158
status=`expr $status + $ret`

n=`expr $n + 1`
159
echo_i "check 'rndc serve-stale status' ($n)"
160
161
162
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1
163
if [ $ret != 0 ]; then echo_i "failed"; fi
164
165
166
status=`expr $status + $ret`

n=`expr $n + 1`
167
echo_i "check stale data.example (serve-stale on) ($n)"
168
ret=0
169
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
170
171
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
172
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
173
if [ $ret != 0 ]; then echo_i "failed"; fi
174
175
176
status=`expr $status + $ret`

n=`expr $n + 1`
177
echo_i "check stale nodata.example (serve-stale on) ($n)"
178
ret=0
179
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
180
181
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
182
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
183
if [ $ret != 0 ]; then echo_i "failed"; fi
184
185
186
status=`expr $status + $ret`

n=`expr $n + 1`
187
echo_i "check stale nxdomain.example (serve-stale on) ($n)"
188
ret=0
189
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
190
191
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
192
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
193
if [ $ret != 0 ]; then echo_i "failed"; fi
194
195
196
status=`expr $status + $ret`

n=`expr $n + 1`
197
echo_i "running 'rndc serve-stale no' ($n)"
198
199
ret=0
$RNDCCMD 10.53.0.1 serve-stale no || ret=1
200
if [ $ret != 0 ]; then echo_i "failed"; fi
201
202
203
status=`expr $status + $ret`

n=`expr $n + 1`
204
echo_i "check 'rndc serve-stale status' ($n)"
205
206
207
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: off (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1
208
if [ $ret != 0 ]; then echo_i "failed"; fi
209
210
211
status=`expr $status + $ret`

n=`expr $n + 1`
212
echo_i "check stale data.example (serve-stale no) ($n)"
213
ret=0
214
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
215
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
216
if [ $ret != 0 ]; then echo_i "failed"; fi
217
218
219
status=`expr $status + $ret`

n=`expr $n + 1`
220
echo_i "check stale nodata.example (serve-stale no) ($n)"
221
ret=0
222
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
223
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
224
if [ $ret != 0 ]; then echo_i "failed"; fi
225
226
227
status=`expr $status + $ret`

n=`expr $n + 1`
228
echo_i "check stale nxdomain.example (serve-stale no) ($n)"
229
ret=0
230
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
231
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
232
if [ $ret != 0 ]; then echo_i "failed"; fi
233
234
235
status=`expr $status + $ret`

n=`expr $n + 1`
236
echo_i "running 'rndc serve-stale yes' ($n)"
237
238
ret=0
$RNDCCMD 10.53.0.1 serve-stale yes || ret=1
239
if [ $ret != 0 ]; then echo_i "failed"; fi
240
241
242
status=`expr $status + $ret`

n=`expr $n + 1`
243
echo_i "check 'rndc serve-stale status' ($n)"
244
245
246
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1
247
if [ $ret != 0 ]; then echo_i "failed"; fi
248
249
250
status=`expr $status + $ret`

n=`expr $n + 1`
251
echo_i "check stale data.example (serve-stale yes) ($n)"
252
ret=0
253
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
254
255
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
256
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
257
if [ $ret != 0 ]; then echo_i "failed"; fi
258
259
260
status=`expr $status + $ret`

n=`expr $n + 1`
261
echo_i "check stale nodata.example (serve-stale yes) ($n)"
262
ret=0
263
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
264
265
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
266
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
267
if [ $ret != 0 ]; then echo_i "failed"; fi
268
269
270
status=`expr $status + $ret`

n=`expr $n + 1`
271
echo_i "check stale nxdomain.example (serve-stale yes) ($n)"
272
ret=0
273
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
274
275
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
276
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
277
if [ $ret != 0 ]; then echo_i "failed"; fi
278
279
280
status=`expr $status + $ret`

n=`expr $n + 1`
281
echo_i "running 'rndc serve-stale off' ($n)"
282
283
ret=0
$RNDCCMD 10.53.0.1 serve-stale off || ret=1
284
if [ $ret != 0 ]; then echo_i "failed"; fi
285
286
287
status=`expr $status + $ret`

n=`expr $n + 1`
288
echo_i "running 'rndc serve-stale reset' ($n)"
289
290
ret=0
$RNDCCMD 10.53.0.1 serve-stale reset || ret=1
291
if [ $ret != 0 ]; then echo_i "failed"; fi
292
293
294
status=`expr $status + $ret`

n=`expr $n + 1`
295
echo_i "check 'rndc serve-stale status' ($n)"
296
297
298
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: on (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1
299
if [ $ret != 0 ]; then echo_i "failed"; fi
300
301
302
status=`expr $status + $ret`

n=`expr $n + 1`
303
echo_i "check stale data.example (serve-stale reset) ($n)"
304
ret=0
305
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
306
307
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
308
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
309
if [ $ret != 0 ]; then echo_i "failed"; fi
310
311
312
status=`expr $status + $ret`

n=`expr $n + 1`
313
echo_i "check stale nodata.example (serve-stale reset) ($n)"
314
ret=0
315
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
316
317
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
318
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
319
if [ $ret != 0 ]; then echo_i "failed"; fi
320
321
322
status=`expr $status + $ret`

n=`expr $n + 1`
323
echo_i "check stale nxdomain.example (serve-stale reset) ($n)"
324
ret=0
325
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
326
327
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
328
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
329
if [ $ret != 0 ]; then echo_i "failed"; fi
330
331
332
status=`expr $status + $ret`

n=`expr $n + 1`
333
echo_i "running 'rndc serve-stale off' ($n)"
334
335
ret=0
$RNDCCMD 10.53.0.1 serve-stale off || ret=1
336
if [ $ret != 0 ]; then echo_i "failed"; fi
337
338
339
status=`expr $status + $ret`

n=`expr $n + 1`
340
echo_i "check 'rndc serve-stale status' ($n)"
341
342
343
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: off (rndc) (stale-answer-ttl=1 max-stale-ttl=3600)' rndc.out.test$n > /dev/null || ret=1
344
if [ $ret != 0 ]; then echo_i "failed"; fi
345
346
347
status=`expr $status + $ret`

n=`expr $n + 1`
348
echo_i "updating ns1/named.conf ($n)"
349
ret=0
350
copy_setports ns1/named2.conf.in ns1/named.conf
351
if [ $ret != 0 ]; then echo_i "failed"; fi
352
353
354
status=`expr $status + $ret`

n=`expr $n + 1`
355
echo_i "running 'rndc reload' ($n)"
356
357
358
ret=0
$RNDCCMD 10.53.0.1 reload > rndc.out.test$n 2>&1 || ret=1
grep "server reload successful" rndc.out.test$n > /dev/null || ret=1
359
if [ $ret != 0 ]; then echo_i "failed"; fi
360
361
362
status=`expr $status + $ret`

n=`expr $n + 1`
363
echo_i "check 'rndc serve-stale status' ($n)"
364
365
366
ret=0
$RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: off (rndc) (stale-answer-ttl=2 max-stale-ttl=7200)' rndc.out.test$n > /dev/null || ret=1
367
if [ $ret != 0 ]; then echo_i "failed"; fi
368
369
370
status=`expr $status + $ret`

n=`expr $n + 1`
371
echo_i "check 'rndc serve-stale' ($n)"
372
373
374
ret=0
$RNDCCMD 10.53.0.1 serve-stale > rndc.out.test$n 2>&1 && ret=1
grep "unexpected end of input" rndc.out.test$n > /dev/null || ret=1
375
if [ $ret != 0 ]; then echo_i "failed"; fi
376
377
378
status=`expr $status + $ret`

n=`expr $n + 1`
379
echo_i "check 'rndc serve-stale unknown' ($n)"
380
381
382
ret=0
$RNDCCMD 10.53.0.1 serve-stale unknown > rndc.out.test$n 2>&1 && ret=1
grep "syntax error" rndc.out.test$n > /dev/null || ret=1
383
if [ $ret != 0 ]; then echo_i "failed"; fi
384
385
status=`expr $status + $ret`

386
387
388
389
390
391
392
393
394
395
396
n=`expr $n + 1`
echo_i "flush cache, re-enable serve-stale and query again ($n)"
ret=0
$RNDCCMD 10.53.0.1 flushtree example > rndc.out.test$n.1 2>&1 || ret=1
$RNDCCMD 10.53.0.1 serve-stale on > rndc.out.test$n.2 2>&1 || ret=1
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`

397
n=`expr $n + 1`
398
echo_i "enable responses from authoritative server ($n)"
399
ret=0
400
$DIG -p ${PORT} @10.53.0.2 txt enable  > dig.out.test$n
401
402
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "TXT.\"1\"" dig.out.test$n > /dev/null || ret=1
403
if [ $ret != 0 ]; then echo_i "failed"; fi
404
405
406
status=`expr $status + $ret`

n=`expr $n + 1`
407
echo_i "prime cache data.example (max-stale-ttl default) ($n)"
408
ret=0
409
$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n
410
411
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
412
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
413
if [ $ret != 0 ]; then echo_i "failed"; fi
414
415
416
status=`expr $status + $ret`

n=`expr $n + 1`
417
echo_i "prime cache nodata.example (max-stale-ttl default) ($n)"
418
ret=0
419
$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n
420
421
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
422
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
423
if [ $ret != 0 ]; then echo_i "failed"; fi
424
425
426
status=`expr $status + $ret`

n=`expr $n + 1`
427
echo_i "prime cache nxdomain.example (max-stale-ttl default) ($n)"
428
ret=0
429
$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
430
431
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
432
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
433
if [ $ret != 0 ]; then echo_i "failed"; fi
434
435
436
status=`expr $status + $ret`

n=`expr $n + 1`
437
echo_i "disable responses from authoritative server ($n)"
438
ret=0
439
$DIG -p ${PORT} @10.53.0.2 txt disable  > dig.out.test$n
440
441
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1
442
if [ $ret != 0 ]; then echo_i "failed"; fi
443
444
445
446
447
status=`expr $status + $ret`

sleep 1

n=`expr $n + 1`
448
echo_i "check 'rndc serve-stale status' ($n)"
449
450
451
ret=0
$RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: off (stale-answer-ttl=1 max-stale-ttl=604800)' rndc.out.test$n > /dev/null || ret=1
452
if [ $ret != 0 ]; then echo_i "failed"; fi
453
454
455
status=`expr $status + $ret`

n=`expr $n + 1`
456
echo_i "check fail of data.example (max-stale-ttl default) ($n)"
457
ret=0
458
$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n
459
460
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
461
if [ $ret != 0 ]; then echo_i "failed"; fi
462
463
464
status=`expr $status + $ret`

n=`expr $n + 1`
465
echo_i "check fail of nodata.example (max-stale-ttl default) ($n)"
466
ret=0
467
$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n
468
469
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
470
if [ $ret != 0 ]; then echo_i "failed"; fi
471
472
473
status=`expr $status + $ret`

n=`expr $n + 1`
474
echo_i "check fail of nxdomain.example (max-stale-ttl default) ($n)"
475
ret=0
476
$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
477
478
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
479
if [ $ret != 0 ]; then echo_i "failed"; fi
480
481
482
status=`expr $status + $ret`

n=`expr $n + 1`
483
echo_i "check 'rndc serve-stale on' ($n)"
484
485
ret=0
$RNDCCMD 10.53.0.3 serve-stale on > rndc.out.test$n 2>&1 || ret=1
486
if [ $ret != 0 ]; then echo_i "failed"; fi
487
488
489
status=`expr $status + $ret`

n=`expr $n + 1`
490
echo_i "check 'rndc serve-stale status' ($n)"
491
492
493
ret=0
$RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1
grep '_default: on (rndc) (stale-answer-ttl=1 max-stale-ttl=604800)' rndc.out.test$n > /dev/null || ret=1
494
if [ $ret != 0 ]; then echo_i "failed"; fi
495
496
497
status=`expr $status + $ret`

n=`expr $n + 1`
498
echo_i "check data.example (max-stale-ttl default) ($n)"
499
ret=0
500
$DIG -p ${PORT} @10.53.0.3 data.example TXT > dig.out.test$n
501
502
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
503
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
504
if [ $ret != 0 ]; then echo_i "failed"; fi
505
506
507
status=`expr $status + $ret`

n=`expr $n + 1`
508
echo_i "check nodata.example (max-stale-ttl default) ($n)"
509
ret=0
510
$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n
511
512
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
513
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
514
if [ $ret != 0 ]; then echo_i "failed"; fi
515
516
517
status=`expr $status + $ret`

n=`expr $n + 1`
518
echo_i "check nxdomain.example (max-stale-ttl default) ($n)"
519
ret=0
520
$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
521
522
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
Michał Kępień's avatar
Michał Kępień committed
523
grep "example.*1.*IN" dig.out.test$n > /dev/null || ret=1
524
if [ $ret != 0 ]; then echo_i "failed"; fi
525
526
status=`expr $status + $ret`

527
echo_i "exit status: $status"
528
[ $status -eq 0 ] || exit 1