1#!/bin/sh
2#
3# Copyright (C) 2010, 2012  Internet Systems Consortium, Inc. ("ISC")
4#
5# Permission to use, copy, modify, and/or distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15# PERFORMANCE OF THIS SOFTWARE.
16
17# Id: tests.sh,v 1.2 2010/06/17 05:38:06 marka Exp
18
19SYSTEMTESTTOP=..
20. $SYSTEMTESTTOP/conf.sh
21
22status=0
23
24rm -f dig.out.*
25
26DIGOPTS="+tcp +noadd +nosea +nostat +nocmd -p 5300"
27
28echo "I:checking slave expiry"
29ret=0
30$DIG $DIGOPTS txt.example. txt @10.53.0.1 > dig.out.before || ret=1
31echo "I:waiting for expiry (10s real, 6h virtual)"
32sleep 10
33$DIG $DIGOPTS txt.example. txt @10.53.0.1 > dig.out.after || ret=1
34if [ $ret != 0 ]; then echo "I:failed"; fi
35status=`expr $status + $ret`
36
37ret=0
38grep "status: NOERROR" dig.out.before > /dev/null || ret=1
39if [ $ret -eq 1 ] ; then
40    echo "I:failed (before)"; status=1
41fi
42ret=0
43grep "status: SERVFAIL" dig.out.after > /dev/null || ret=1
44if [ $ret -eq 1 ] ; then
45    echo "I:failed (after)"; status=1
46fi
47
48echo "I:exit status: $status"
49exit $status
50