tests.sh 16.9 KB
Newer Older
1
2
#!/bin/sh
#
3
# Copyright (C) 2017  Internet Systems Consortium, Inc. ("ISC")
4
5
6
7
8
9
10
#
# 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/.

SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
11
. $SYSTEMTESTTOP/getopts.sh
12
13
14

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

15
16
17
status=0
n=0

18
#echo_i "check ans.pl server ($n)"
19
20
21
22
23
24
25
26
27
28
29
30
#$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
31
32

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

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

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

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

sleep 1

n=`expr $n + 1`
71
echo_i "check 'rndc serve-stale status' ($n)"
72
73
74
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
75
if [ $ret != 0 ]; then echo_i "failed"; fi
76
77
78
status=`expr $status + $ret`

n=`expr $n + 1`
79
echo_i "check stale data.example ($n)"
80
ret=0
81
$DIG -p ${port} @10.53.0.1 data.example TXT > dig.out.test$n
82
83
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
84
if [ $ret != 0 ]; then echo_i "failed"; fi
85
86
87
status=`expr $status + $ret`

n=`expr $n + 1`
88
echo_i "check stale nodata.example ($n)"
89
ret=0
90
$DIG -p ${port} @10.53.0.1 nodata.example TXT > dig.out.test$n
91
92
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
93
if [ $ret != 0 ]; then echo_i "failed"; fi
94
95
96
status=`expr $status + $ret`

n=`expr $n + 1`
97
echo_i "check stale nxdomain.example ($n)"
98
ret=0
99
$DIG -p ${port} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
100
101
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
102
if [ $ret != 0 ]; then echo_i "failed"; fi
103
104
105
status=`expr $status + $ret`

n=`expr $n + 1`
106
echo_i "running 'rndc serve-stale off' ($n)"
107
108
ret=0
$RNDCCMD 10.53.0.1 serve-stale off || ret=1
109
if [ $ret != 0 ]; then echo_i "failed"; fi
110
111
112
status=`expr $status + $ret`

n=`expr $n + 1`
113
echo_i "check 'rndc serve-stale status' ($n)"
114
115
116
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
117
if [ $ret != 0 ]; then echo_i "failed"; fi
118
119
120
status=`expr $status + $ret`

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

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

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

n=`expr $n + 1`
147
echo_i "running 'rndc serve-stale on' ($n)"
148
149
ret=0
$RNDCCMD 10.53.0.1 serve-stale on || ret=1
150
if [ $ret != 0 ]; then echo_i "failed"; fi
151
152
153
status=`expr $status + $ret`

n=`expr $n + 1`
154
echo_i "check 'rndc serve-stale status' ($n)"
155
156
157
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
158
if [ $ret != 0 ]; then echo_i "failed"; fi
159
160
161
status=`expr $status + $ret`

n=`expr $n + 1`
162
echo_i "check stale data.example (serve-stale on) ($n)"
163
ret=0
164
$DIG -p ${port} @10.53.0.1 data.example TXT > dig.out.test$n
165
166
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
167
if [ $ret != 0 ]; then echo_i "failed"; fi
168
169
170
status=`expr $status + $ret`

n=`expr $n + 1`
171
echo_i "check stale nodata.example (serve-stale on) ($n)"
172
ret=0
173
$DIG -p ${port} @10.53.0.1 nodata.example TXT > dig.out.test$n
174
175
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
176
if [ $ret != 0 ]; then echo_i "failed"; fi
177
178
179
status=`expr $status + $ret`

n=`expr $n + 1`
180
echo_i "check stale nxdomain.example (serve-stale on) ($n)"
181
ret=0
182
$DIG -p ${port} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
183
184
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
185
if [ $ret != 0 ]; then echo_i "failed"; fi
186
187
188
status=`expr $status + $ret`

n=`expr $n + 1`
189
echo_i "running 'rndc serve-stale no' ($n)"
190
191
ret=0
$RNDCCMD 10.53.0.1 serve-stale no || ret=1
192
if [ $ret != 0 ]; then echo_i "failed"; fi
193
194
195
status=`expr $status + $ret`

n=`expr $n + 1`
196
echo_i "check 'rndc serve-stale status' ($n)"
197
198
199
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
200
if [ $ret != 0 ]; then echo_i "failed"; fi
201
202
203
status=`expr $status + $ret`

n=`expr $n + 1`
204
echo_i "check stale data.example (serve-stale no) ($n)"
205
ret=0
206
$DIG -p ${port} @10.53.0.1 data.example TXT > dig.out.test$n
207
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
208
if [ $ret != 0 ]; then echo_i "failed"; fi
209
status=`expr $status + $ret`
210
if [ $ret != 0 ]; then echo_i "failed"; fi
211
212
213
status=`expr $status + $ret`

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

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

n=`expr $n + 1`
230
echo_i "running 'rndc serve-stale yes' ($n)"
231
232
ret=0
$RNDCCMD 10.53.0.1 serve-stale yes || ret=1
233
if [ $ret != 0 ]; then echo_i "failed"; fi
234
235
236
status=`expr $status + $ret`

n=`expr $n + 1`
237
echo_i "check 'rndc serve-stale status' ($n)"
238
239
240
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
241
if [ $ret != 0 ]; then echo_i "failed"; fi
242
243
244
status=`expr $status + $ret`

n=`expr $n + 1`
245
echo_i "check stale data.example (serve-stale yes) ($n)"
246
ret=0
247
$DIG -p ${port} @10.53.0.1 data.example TXT > dig.out.test$n
248
249
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
250
if [ $ret != 0 ]; then echo_i "failed"; fi
251
252
253
status=`expr $status + $ret`

n=`expr $n + 1`
254
echo_i "check stale nodata.example (serve-stale yes) ($n)"
255
ret=0
256
$DIG -p ${port} @10.53.0.1 nodata.example TXT > dig.out.test$n
257
258
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
259
if [ $ret != 0 ]; then echo_i "failed"; fi
260
261
262
status=`expr $status + $ret`

n=`expr $n + 1`
263
echo_i "check stale nxdomain.example (serve-stale yes) ($n)"
264
ret=0
265
$DIG -p ${port} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
266
267
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
268
if [ $ret != 0 ]; then echo_i "failed"; fi
269
270
271
status=`expr $status + $ret`

n=`expr $n + 1`
272
echo_i "running 'rndc serve-stale off' ($n)"
273
274
ret=0
$RNDCCMD 10.53.0.1 serve-stale off || ret=1
275
if [ $ret != 0 ]; then echo_i "failed"; fi
276
277
278
status=`expr $status + $ret`

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

n=`expr $n + 1`
286
echo_i "check 'rndc serve-stale status' ($n)"
287
288
289
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
290
if [ $ret != 0 ]; then echo_i "failed"; fi
291
292
293
status=`expr $status + $ret`

n=`expr $n + 1`
294
echo_i "check stale data.example (serve-stale reset) ($n)"
295
ret=0
296
$DIG -p ${port} @10.53.0.1 data.example TXT > dig.out.test$n
297
298
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.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 nodata.example (serve-stale reset) ($n)"
304
ret=0
305
$DIG -p ${port} @10.53.0.1 nodata.example TXT > dig.out.test$n
306
307
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
308
if [ $ret != 0 ]; then echo_i "failed"; fi
309
310
311
status=`expr $status + $ret`

n=`expr $n + 1`
312
echo_i "check stale nxdomain.example (serve-stale reset) ($n)"
313
ret=0
314
$DIG -p ${port} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
315
316
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
317
if [ $ret != 0 ]; then echo_i "failed"; fi
318
319
320
status=`expr $status + $ret`

n=`expr $n + 1`
321
echo_i "running 'rndc serve-stale off' ($n)"
322
323
ret=0
$RNDCCMD 10.53.0.1 serve-stale off || ret=1
324
if [ $ret != 0 ]; then echo_i "failed"; fi
325
326
327
status=`expr $status + $ret`

n=`expr $n + 1`
328
echo_i "check 'rndc serve-stale status' ($n)"
329
330
331
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
332
if [ $ret != 0 ]; then echo_i "failed"; fi
333
334
335
status=`expr $status + $ret`

n=`expr $n + 1`
336
echo_i "updating ns1/named.conf ($n)"
337
ret=0
338
$SEDPORTS < ns1/named2.conf.in > ns1/named.conf
339
if [ $ret != 0 ]; then echo_i "failed"; fi
340
341
342
status=`expr $status + $ret`

n=`expr $n + 1`
343
echo_i "running 'rndc reload' ($n)"
344
345
346
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
347
if [ $ret != 0 ]; then echo_i "failed"; fi
348
349
350
status=`expr $status + $ret`

n=`expr $n + 1`
351
echo_i "check 'rndc serve-stale status' ($n)"
352
353
354
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
355
if [ $ret != 0 ]; then echo_i "failed"; fi
356
357
358
status=`expr $status + $ret`

n=`expr $n + 1`
359
echo_i "check 'rndc serve-stale' ($n)"
360
361
362
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
363
if [ $ret != 0 ]; then echo_i "failed"; fi
364
365
366
status=`expr $status + $ret`

n=`expr $n + 1`
367
echo_i "check 'rndc serve-stale unknown' ($n)"
368
369
370
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
371
if [ $ret != 0 ]; then echo_i "failed"; fi
372
373
374
status=`expr $status + $ret`

n=`expr $n + 1`
375
echo_i "enable responses from authoritative server ($n)"
376
ret=0
377
$DIG -p ${port} @10.53.0.2 txt enable  > dig.out.test$n
378
379
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "TXT.\"1\"" dig.out.test$n > /dev/null || ret=1
380
if [ $ret != 0 ]; then echo_i "failed"; fi
381
382
383
status=`expr $status + $ret`

n=`expr $n + 1`
384
echo_i "prime cache data.example (max-stale-ttl default) ($n)"
385
ret=0
386
$DIG -p ${port} @10.53.0.3 data.example TXT > dig.out.test$n
387
388
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
389
if [ $ret != 0 ]; then echo_i "failed"; fi
390
391
392
status=`expr $status + $ret`

n=`expr $n + 1`
393
echo_i "prime cache nodata.example (max-stale-ttl default) ($n)"
394
ret=0
395
$DIG -p ${port} @10.53.0.3 nodata.example TXT > dig.out.test$n
396
397
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
398
if [ $ret != 0 ]; then echo_i "failed"; fi
399
400
401
status=`expr $status + $ret`

n=`expr $n + 1`
402
echo_i "prime cache nxdomain.example (max-stale-ttl default) ($n)"
403
ret=0
404
$DIG -p ${port} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
405
406
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
407
if [ $ret != 0 ]; then echo_i "failed"; fi
408
409
410
status=`expr $status + $ret`

n=`expr $n + 1`
411
echo_i "disable responses from authoritative server ($n)"
412
ret=0
413
$DIG -p ${port} @10.53.0.2 txt disable  > dig.out.test$n
414
415
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
grep "TXT.\"0\"" dig.out.test$n > /dev/null || ret=1
416
if [ $ret != 0 ]; then echo_i "failed"; fi
417
418
419
420
421
status=`expr $status + $ret`

sleep 1

n=`expr $n + 1`
422
echo_i "check 'rndc serve-stale status' ($n)"
423
424
425
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
426
if [ $ret != 0 ]; then echo_i "failed"; fi
427
428
429
status=`expr $status + $ret`

n=`expr $n + 1`
430
echo_i "check fail of data.example (max-stale-ttl default) ($n)"
431
ret=0
432
$DIG -p ${port} @10.53.0.3 data.example TXT > dig.out.test$n
433
434
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
435
if [ $ret != 0 ]; then echo_i "failed"; fi
436
437
438
status=`expr $status + $ret`

n=`expr $n + 1`
439
echo_i "check fail of nodata.example (max-stale-ttl default) ($n)"
440
ret=0
441
$DIG -p ${port} @10.53.0.3 nodata.example TXT > dig.out.test$n
442
443
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
444
if [ $ret != 0 ]; then echo_i "failed"; fi
445
446
447
status=`expr $status + $ret`

n=`expr $n + 1`
448
echo_i "check fail of nxdomain.example (max-stale-ttl default) ($n)"
449
ret=0
450
$DIG -p ${port} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
451
452
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
453
if [ $ret != 0 ]; then echo_i "failed"; fi
454
455
456
status=`expr $status + $ret`

n=`expr $n + 1`
457
echo_i "check 'rndc serve-stale on' ($n)"
458
459
ret=0
$RNDCCMD 10.53.0.3 serve-stale on > rndc.out.test$n 2>&1 || ret=1
460
if [ $ret != 0 ]; then echo_i "failed"; fi
461
462
463
status=`expr $status + $ret`

n=`expr $n + 1`
464
echo_i "check 'rndc serve-stale status' ($n)"
465
466
467
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
468
if [ $ret != 0 ]; then echo_i "failed"; fi
469
470
471
status=`expr $status + $ret`

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

n=`expr $n + 1`
481
echo_i "check nodata.example (max-stale-ttl default) ($n)"
482
ret=0
483
$DIG -p ${port} @10.53.0.3 nodata.example TXT > dig.out.test$n
484
485
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || 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 nxdomain.example (max-stale-ttl default) ($n)"
491
ret=0
492
$DIG -p ${port} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
493
494
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
495
if [ $ret != 0 ]; then echo_i "failed"; fi
496
497
status=`expr $status + $ret`

498
echo_i "exit status: $status"
499
[ $status -eq 0 ] || exit 1