3 # Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
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.
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.
17 # $Id: tests.sh,v 1.2.2.2 2010/08/11 18:19:55 each Exp $
20 . $SYSTEMTESTTOP/conf.sh
22 DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p 5300"
26 echo "I:checking normally loaded zone ($n)"
28 $DIG $DIGOPTS @10.53.0.2 a.normal.example a > dig.out.ns2.$n || ret=1
29 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
30 grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1
32 if [ $ret != 0 ]; then echo "I:failed"; fi
33 status=`expr $status + $ret`
35 echo "I:checking previously added zone ($n)"
37 $DIG $DIGOPTS @10.53.0.2 a.previous.example a > dig.out.ns2.$n || ret=1
38 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
39 grep '^a.previous.example' dig.out.ns2.$n > /dev/null || ret=1
41 if [ $ret != 0 ]; then echo "I:failed"; fi
42 status=`expr $status + $ret`
44 echo "I:adding new zone ($n)"
46 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 addzone 'added.example { type master; file "added.db"; };' 2>&1 | sed 's/^/I:ns2 /'
47 $DIG $DIGOPTS @10.53.0.2 a.added.example a > dig.out.ns2.$n || ret=1
48 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
49 grep '^a.added.example' dig.out.ns2.$n > /dev/null || ret=1
51 if [ $ret != 0 ]; then echo "I:failed"; fi
52 status=`expr $status + $ret`
54 echo "I:deleting previously added zone ($n)"
56 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone previous.example 2>&1 | sed 's/^/I:ns2 /'
57 $DIG $DIGOPTS @10.53.0.2 a.previous.example a > dig.out.ns2.$n
58 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
59 grep '^a.previous.example' dig.out.ns2.$n > /dev/null && ret=1
61 if [ $ret != 0 ]; then echo "I:failed"; fi
62 status=`expr $status + $ret`
64 echo "I:deleting newly added zone ($n)"
66 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone added.example 2>&1 | sed 's/^/I:ns2 /'
67 $DIG $DIGOPTS @10.53.0.2 a.added.example a > dig.out.ns2.$n
68 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
69 grep '^a.added.example' dig.out.ns2.$n > /dev/null && ret=1
71 if [ $ret != 0 ]; then echo "I:failed"; fi
72 status=`expr $status + $ret`
74 echo "I:attempt to delete a normally-loaded zone (should fail) ($n)"
76 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone normal.example 2>&1 | sed 's/^/I:ns2 /'
77 $DIG $DIGOPTS @10.53.0.2 a.normal.example a > dig.out.ns2.$n
78 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
79 grep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1
81 if [ $ret != 0 ]; then echo "I:failed"; fi
82 status=`expr $status + $ret`
84 echo "I:reconfiguring server with multiple views"
86 cp -f ns2/named2.conf ns2/named.conf
87 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reconfig 2>&1 | sed 's/^/I:ns2 /'
90 echo "I:adding new zone to external view ($n)"
92 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 addzone 'added.example in external { type master; file "added.db"; };' 2>&1 | sed 's/^/I:ns2 /'
93 $DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 a.added.example a > dig.out.ns2.int.$n || ret=1
94 $DIG $DIGOPTS @10.53.0.4 -b 10.53.0.4 a.added.example a > dig.out.ns2.ext.$n || ret=1
95 grep 'status: REFUSED' dig.out.ns2.int.$n > /dev/null || ret=1
96 grep 'status: NOERROR' dig.out.ns2.ext.$n > /dev/null || ret=1
97 grep '^a.added.example' dig.out.ns2.ext.$n > /dev/null || ret=1
99 if [ $ret != 0 ]; then echo "I:failed"; fi
100 status=`expr $status + $ret`
102 echo "I:deleting newly added zone ($n)"
104 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone 'added.example in external' 2>&1 | sed 's/^/I:ns2 /'
105 $DIG $DIGOPTS @10.53.0.4 -b 10.53.0.4 a.added.example a > dig.out.ns2.$n || ret=1
106 grep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
107 grep '^a.added.example' dig.out.ns2.$n > /dev/null && ret=1
109 if [ $ret != 0 ]; then echo "I:failed"; fi
110 status=`expr $status + $ret`
112 echo "I:attempting to add zone to internal view (should fail) ($n)"
114 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 addzone 'added.example in internal { type master; file "added.db"; };' 2>&1 | sed 's/^/I:ns2 /'
115 $DIG $DIGOPTS @10.53.0.2 -b 10.53.0.2 a.added.example a > dig.out.ns2.$n || ret=1
116 grep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
118 if [ $ret != 0 ]; then echo "I:failed"; fi
119 status=`expr $status + $ret`
121 echo "I:exit status: $status"