1# Copyright (C) 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") 2# 3# Permission to use, copy, modify, and/or distribute this software for any 4# purpose with or without fee is hereby granted, provided that the above 5# copyright notice and this permission notice appear in all copies. 6# 7# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 8# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 9# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 10# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 11# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 12# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 13# PERFORMANCE OF THIS SOFTWARE. 14 15# Id: tests.sh,v 1.3 2011/08/09 04:12:25 tbox Exp 16 17status=0 18n=0 19 20n=`expr $n + 1` 21echo "I:Checking that reconfiguring empty zones is silent ($n)" 22$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reconfig 23ret=0 24grep "automatic empty zone" ns1/named.run > /dev/null || ret=1 25grep "received control channel command 'reconfig'" ns1/named.run > /dev/null || ret=1 26grep "reloading configuration succeeded" ns1/named.run > /dev/null || ret=1 27sleep 1 28grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1 29if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 30 31n=`expr $n + 1` 32echo "I:Checking that reloading empty zones is silent ($n)" 33$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reload > /dev/null 34ret=0 35grep "automatic empty zone" ns1/named.run > /dev/null || ret=1 36grep "received control channel command 'reload'" ns1/named.run > /dev/null || ret=1 37grep "reloading configuration succeeded" ns1/named.run > /dev/null || ret=1 38sleep 1 39grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1 40if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 41 42VERSION=`../../../../isc-config.sh --version | cut -d = -f 2` 43HOSTNAME=`./gethostname` 44 45n=`expr $n + 1` 46ret=0 47echo "I:Checking that default version works for rndc ($n)" 48$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 status > rndc.status.ns1.$n 2>&1 49grep "^version: $VERSION " rndc.status.ns1.$n > /dev/null || ret=1 50if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 51 52n=`expr $n + 1` 53ret=0 54echo "I:Checking that custom version works for rndc ($n)" 55$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 status > rndc.status.ns3.$n 2>&1 56grep "^version: $VERSION (this is a test of version) " rndc.status.ns3.$n > /dev/null || ret=1 57if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 58 59n=`expr $n + 1` 60ret=0 61echo "I:Checking that default version works for query ($n)" 62$DIG +short version.bind txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n 63grep "^\"$VERSION\"$" dig.out.ns1.$n > /dev/null || ret=1 64if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 65 66n=`expr $n + 1` 67ret=0 68echo "I:Checking that custom version works for query ($n)" 69$DIG +short version.bind txt ch @10.53.0.3 -p 5300 > dig.out.ns3.$n 70grep "^\"this is a test of version\"$" dig.out.ns3.$n > /dev/null || ret=1 71if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 72 73n=`expr $n + 1` 74ret=0 75echo "I:Checking that default hostname works for query ($n)" 76$DIG +short hostname.bind txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n 77grep "^\"$HOSTNAME\"$" dig.out.ns1.$n > /dev/null || ret=1 78if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 79 80n=`expr $n + 1` 81ret=0 82echo "I:Checking that custom hostname works for query ($n)" 83$DIG +short hostname.bind txt ch @10.53.0.3 -p 5300 > dig.out.ns3.$n 84grep "^\"this.is.a.test.of.hostname\"$" dig.out.ns3.$n > /dev/null || ret=1 85if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 86 87n=`expr $n + 1` 88ret=0 89echo "I:Checking that default server-id is none for query ($n)" 90$DIG id.server txt ch @10.53.0.1 -p 5300 > dig.out.ns1.$n 91grep "status: NOERROR" dig.out.ns1.$n > /dev/null || ret=1 92grep "ANSWER: 0" dig.out.ns1.$n > /dev/null || ret=1 93if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 94 95n=`expr $n + 1` 96ret=0 97echo "I:Checking that server-id hostname works for query ($n)" 98$DIG +short id.server txt ch @10.53.0.2 -p 5300 > dig.out.ns2.$n 99grep "^\"$HOSTNAME\"$" dig.out.ns2.$n > /dev/null || ret=1 100if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 101 102n=`expr $n + 1` 103ret=0 104echo "I:Checking that server-id hostname works for EDNS name server ID request ($n)" 105$DIG +norec +nsid foo @10.53.0.2 -p 5300 > dig.out.ns2.$n 106grep "^; NSID: .* (\"$HOSTNAME\")$" dig.out.ns2.$n > /dev/null || ret=1 107if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 108 109n=`expr $n + 1` 110ret=0 111echo "I:Checking that custom server-id works for query ($n)" 112$DIG +short id.server txt ch @10.53.0.3 -p 5300 > dig.out.ns3.$n 113grep "^\"this.is.a.test.of.server-id\"$" dig.out.ns3.$n > /dev/null || ret=1 114if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 115 116n=`expr $n + 1` 117ret=0 118echo "I:Checking that custom server-id works for EDNS name server ID request ($n)" 119$DIG +norec +nsid foo @10.53.0.3 -p 5300 > dig.out.ns3.$n 120grep "^; NSID: .* (\"this.is.a.test.of.server-id\")$" dig.out.ns3.$n > /dev/null || ret=1 121if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi 122 123exit $status 124