tests.sh 16.8 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

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

14
15
16
status=0
n=0

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

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

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

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

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

sleep 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

n=`expr $n + 1`
262
echo_i "check stale nxdomain.example (serve-stale yes) ($n)"
263
ret=0
264
$DIG -p ${PORT} @10.53.0.1 nxdomain.example TXT > dig.out.test$n
265
266
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," 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 "running 'rndc serve-stale off' ($n)"
272
273
ret=0
$RNDCCMD 10.53.0.1 serve-stale off || ret=1
274
if [ $ret != 0 ]; then echo_i "failed"; fi
275
276
277
status=`expr $status + $ret`

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

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

n=`expr $n + 1`
293
echo_i "check stale data.example (serve-stale reset) ($n)"
294
ret=0
295
$DIG -p ${PORT} @10.53.0.1 data.example TXT > dig.out.test$n
296
297
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
298
if [ $ret != 0 ]; then echo_i "failed"; fi
299
300
301
status=`expr $status + $ret`

n=`expr $n + 1`
302
echo_i "check stale nodata.example (serve-stale reset) ($n)"
303
ret=0
304
$DIG -p ${PORT} @10.53.0.1 nodata.example TXT > dig.out.test$n
305
306
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
307
if [ $ret != 0 ]; then echo_i "failed"; fi
308
309
310
status=`expr $status + $ret`

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

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

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

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

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

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

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

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

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

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

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

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

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

sleep 1

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

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

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

n=`expr $n + 1`
447
echo_i "check fail of nxdomain.example (max-stale-ttl default) ($n)"
448
ret=0
449
$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
450
451
grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.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 'rndc serve-stale on' ($n)"
457
458
ret=0
$RNDCCMD 10.53.0.3 serve-stale on > rndc.out.test$n 2>&1 || ret=1
459
if [ $ret != 0 ]; then echo_i "failed"; fi
460
461
462
status=`expr $status + $ret`

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

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

n=`expr $n + 1`
480
echo_i "check nodata.example (max-stale-ttl default) ($n)"
481
ret=0
482
$DIG -p ${PORT} @10.53.0.3 nodata.example TXT > dig.out.test$n
483
484
grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
485
if [ $ret != 0 ]; then echo_i "failed"; fi
486
487
488
status=`expr $status + $ret`

n=`expr $n + 1`
489
echo_i "check nxdomain.example (max-stale-ttl default) ($n)"
490
ret=0
491
$DIG -p ${PORT} @10.53.0.3 nxdomain.example TXT > dig.out.test$n
492
493
grep "status: NXDOMAIN" dig.out.test$n > /dev/null || ret=1
grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
494
if [ $ret != 0 ]; then echo_i "failed"; fi
495
496
status=`expr $status + $ret`

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