2012-05-14 10:06:05 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
2015-06-29 23:45:23 +00:00
|
|
|
# Copyright (C) 2012, 2015 Internet Systems Consortium, Inc. ("ISC")
|
2012-06-29 11:39:47 +10:00
|
|
|
#
|
|
|
|
|
# Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
# copyright notice and this permission notice appear in all copies.
|
|
|
|
|
#
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
|
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
|
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
|
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
|
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
|
|
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
# PERFORMANCE OF THIS SOFTWARE.
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
# $Id: tests.sh,v 1.1.4.11 2012/02/01 16:54:32 each Exp $
|
|
|
|
|
|
|
|
|
|
SYSTEMTESTTOP=..
|
|
|
|
|
. $SYSTEMTESTTOP/conf.sh
|
|
|
|
|
|
|
|
|
|
DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
|
|
|
|
|
DIGCMD="$DIG $DIGOPTS -p 5300"
|
|
|
|
|
RNDCCMD="$RNDC -p 9953 -c ../common/rndc.conf"
|
|
|
|
|
|
|
|
|
|
status=0
|
2015-06-29 18:33:18 +05:30
|
|
|
|
2012-05-14 10:06:05 -07:00
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
n=1
|
|
|
|
|
|
|
|
|
|
echo "I:fetching a.example from ns2's initial configuration ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
$DIGCMD +noauth a.example. @10.53.0.2 any > dig.out.ns2.1 || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I:verifying adb records in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
$RNDCCMD -s 10.53.0.2 stats > /dev/null 2>&1
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I: checking for 1 entry in adb hash table in named.stats"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "1 Addresses in hash table" ns2/named.stats > /dev/null || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I: verifying cache statistics in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "Cache Statistics" ns2/named.stats > /dev/null || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I: checking for 2 entries in adb hash table in named.stats"
|
2012-05-14 10:06:05 -07:00
|
|
|
$DIGCMD a.example.info. @10.53.0.2 any > /dev/null 2>&1
|
2015-07-09 21:18:42 -07:00
|
|
|
|
|
|
|
|
ret=0
|
2012-05-14 10:06:05 -07:00
|
|
|
$RNDCCMD -s 10.53.0.2 stats > /dev/null 2>&1
|
|
|
|
|
grep "2 Addresses in hash table" ns2/named.stats > /dev/null || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
|
|
|
|
echo "I:dumping initial stats for ns3"
|
|
|
|
|
rm -f ns3/named.stats
|
|
|
|
|
$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1
|
|
|
|
|
[ -f ns3/named.stats ] || ret=1
|
2015-07-09 21:18:42 -07:00
|
|
|
nsock0nstat=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
|
|
|
|
|
|
2012-05-14 10:06:05 -07:00
|
|
|
echo "I:sending queries to ns3"
|
|
|
|
|
$DIGCMD +tries=2 +time=1 +recurse @10.53.0.3 foo.info. any > /dev/null 2>&1
|
|
|
|
|
#$DIGCMD +tries=2 +time=1 +recurse @10.53.0.3 foo.info. any
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I:dumping updated stats for ns3 ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
rm -f ns3/named.stats
|
|
|
|
|
$RNDCCMD -s 10.53.0.3 stats > /dev/null 2>&1
|
|
|
|
|
[ -f ns3/named.stats ] || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I: verifying recursing clients output in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "2 recursing clients" ns3/named.stats > /dev/null || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I: verifying active fetches output in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "1 active fetches" ns3/named.stats > /dev/null || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
|
|
|
|
|
|
|
|
|
echo "I: verifying active sockets output in named.stats"
|
|
|
|
|
nsock1nstat=`grep "UDP/IPv4 sockets active" ns3/named.stats | awk '{print $1}'`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
[ `expr $nsock1nstat - $nsock0nstat` -eq 1 ] || ret=1
|
2012-05-14 10:06:05 -07:00
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
|
|
|
|
# there should be 1 UDP and no TCP queries. As the TCP counter is zero
|
|
|
|
|
# no status line is emitted.
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I: verifying queries in progress in named.stats ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "1 UDP queries in progress" ns3/named.stats > /dev/null || ret=1
|
|
|
|
|
grep "TCP queries in progress" ns3/named.stats > /dev/null && ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
|
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
echo "I: verifying bucket size output ($n)"
|
2012-05-14 10:06:05 -07:00
|
|
|
grep "bucket size" ns3/named.stats > /dev/null || ret=1
|
|
|
|
|
if [ $ret != 0 ]; then echo "I: failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
2012-05-14 10:06:05 -07:00
|
|
|
|
2015-06-29 18:33:18 +05:30
|
|
|
ret=0
|
2015-07-09 21:18:42 -07:00
|
|
|
n=`expr $n + 1`
|
|
|
|
|
echo "I:checking that zones with slash are properly shown in XML output ($n)"
|
2015-08-18 22:00:31 +10:00
|
|
|
if ./xmlstats && [ -x ${CURL} ] ; then
|
2015-06-29 18:33:18 +05:30
|
|
|
${CURL} http://10.53.0.1:8053/xml/v3/zones > curl.out.${t} 2>/dev/null || ret=1
|
2015-08-18 10:03:58 +10:00
|
|
|
grep '<zone name="32/1.0.0.127-in-addr.example" rdataclass="IN">' curl.out.${t} > /dev/null || ret=1
|
2015-06-29 18:33:18 +05:30
|
|
|
else
|
2015-08-18 22:00:31 +10:00
|
|
|
echo "I:skipping test as libxml2 and/or curl was not found"
|
2015-06-29 18:33:18 +05:30
|
|
|
fi
|
|
|
|
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
|
|
|
|
|
2015-10-28 09:45:46 +11:00
|
|
|
ret=0
|
|
|
|
|
n=`expr $n + 1`
|
|
|
|
|
echo "I:checking that zones return their type ($n)"
|
|
|
|
|
if ./xmlstats && [ -x ${CURL} ] ; then
|
|
|
|
|
${CURL} http://10.53.0.1:8053/xml/v3/zones > curl.out.${t} 2>/dev/null || ret=1
|
|
|
|
|
grep '<zone name="32/1.0.0.127-in-addr.example" rdataclass="IN"><type>master</type>' curl.out.${t} > /dev/null || ret=1
|
|
|
|
|
else
|
|
|
|
|
echo "I:skipping test as libxml2 and/or curl was not found"
|
|
|
|
|
fi
|
|
|
|
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
|
|
|
|
status=`expr $status + $ret`
|
|
|
|
|
|
2012-05-14 10:06:05 -07:00
|
|
|
echo "I:exit status: $status"
|
|
|
|
|
exit $status
|