tests.sh revision 247bf378605811d695e968dbe930a7fc45c0038e
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * Copyright (C) 2010, 2011 Internet Systems Consortium, Inc. ("ISC")
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * Permission to use, copy, modify, and/or distribute this software for any
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews * purpose with or without fee is hereby granted, provided that the above
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * copyright notice and this permission notice appear in all copies.
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews# $Id: tests.sh,v 1.6 2011/06/17 23:47:49 tbox Exp $
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark AndrewsDIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p 5300"
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsecho "I:checking normally loaded zone ($n)"
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$DIG $DIGOPTS @10.53.0.2 a.normal.example a > dig.out.ns2.$n || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep '^a.normal.example' dig.out.ns2.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsecho "I:checking previously added zone ($n)"
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$DIG $DIGOPTS @10.53.0.2 a.previous.example a > dig.out.ns2.$n || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep '^a.previous.example' dig.out.ns2.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsecho "I:adding new zone ($n)"
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$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 /'
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$DIG $DIGOPTS @10.53.0.2 a.added.example a > dig.out.ns2.$n || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep 'status: NOERROR' dig.out.ns2.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep '^a.added.example' dig.out.ns2.$n > /dev/null || ret=1
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecickiecho "I:adding new zone with missing master file ($n)"
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$DIG $DIGOPTS +all @10.53.0.2 a.missing.example a > dig.out.ns2.pre.$n || ret=1
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecickigrep "status: REFUSED" dig.out.ns2.pre.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 addzone 'missing.example { type master; file "missing.db"; };' 2> rndc.out.ns2.$n
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecickigrep "file not found" rndc.out.ns2.$n > /dev/null || ret=1
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer$DIG $DIGOPTS +all @10.53.0.2 a.missing.example a > dig.out.ns2.post.$n || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep "status: REFUSED" dig.out.ns2.post.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$PERL ../digcomp.pl dig.out.ns2.pre.$n dig.out.ns2.post.$n || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsecho "I:deleting previously added zone ($n)"
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone previous.example 2>&1 | sed 's/^/I:ns2 /'
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$DIG $DIGOPTS @10.53.0.2 a.previous.example a > dig.out.ns2.$n
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
cc51cd2d2076e33117c60c9effcb8caccde4983bWitold Krecickigrep '^a.previous.example' dig.out.ns2.$n > /dev/null && ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsecho "I:deleting newly added zone ($n)"
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone added.example 2>&1 | sed 's/^/I:ns2 /'
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrews$DIG $DIGOPTS @10.53.0.2 a.added.example a > dig.out.ns2.$n
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayergrep 'status: REFUSED' dig.out.ns2.$n > /dev/null || ret=1
132410d33fa565dd5a4254a1aca17ccd4e872a27Mark Andrewsgrep '^a.added.example' dig.out.ns2.$n > /dev/null && ret=1
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayerecho "I:attempt to delete a normally-loaded zone ($n)"
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayer$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone normal.example 2> rndc.out.ns2.$n
5236050c0f819b727dfc4850133f5194f346f76fDanny Mayergrep "permission denied" rndc.out.ns2.$n > /dev/null || ret=1
n=`expr $n + 1`
$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 /'
n=`expr $n + 1`
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone 'added.example in external' 2>&1 | sed 's/^/I:ns2 /'
n=`expr $n + 1`
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 addzone 'added.example in internal { type master; file "added.db"; };' 2> rndc.out.ns2.$n
n=`expr $n + 1`
n=`expr $n + 1`
echo "I:exit status: $status"
exit $status