tests.sh revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
#
# Copyright (C) 2009, 2010, 2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id: tests.sh,v 1.7 2010/01/18 19:19:31 each Exp $
# replace_data dname RR old_data new_data
{
if [ $# -ne 4 ]; then
echo I:unexpected input for replace_data
return 1
fi
_dname=$1
_rr=$2
_olddata=$3
_newdata=$4
_ret=0
$NSUPDATE -d <<END >> nsupdate.out.test 2>&1 || _ret=1
server 10.53.0.2 5300
update delete ${_dname} 30 ${_rr} ${_olddata}
update add ${_dname} 30 ${_rr} ${_newdata}
send
END
if [ $_ret != 0 ]; then
return 1
fi
return 0
}
status=0
n=0
DIGOPTS="+short +tcp -p 5300"
DIGOPTS_CD="$DIGOPTS +cd"
ret=0
expect="10 mail.example."
ret=0
expect="10.0.0.2"
#
# Prime cache with pending additional records. These should not be promoted
# to answer.
#
echo "I:Priming cache (pending additional A and AAAA)"
ret=0
expect="10 mail.example.com."
echo "I:Replacing pending A"
ret=0
echo "I:Replacing pending AAAA"
ret=0
echo "I:Checking updated data to be returned (without CD)"
ret=0
expect="192.0.2.3"
echo "I:Checking updated data to be returned (with CD)"
ret=0
expect="2001:db8::3"
#
# Prime cache with a pending answer record. It can be returned (without
# validation) with +CD.
#
echo "I:Priming cache (pending answer)"
ret=0
expect="192.0.2.2"
ret=0
ret=0
expect="192.0.2.2"
#
# Prime cache with a pending answer record. It should not be returned
# to no-DNSSEC clients.
#
echo "I:Priming cache (pending answer)"
ret=0
expect="192.0.2.102"
ret=0
ret=0
expect="192.0.2.103"
#
# Try to fool the resolver with an out-of-bailiwick CNAME
#
ret=0
expect="10.10.10.10"
ret=0
expect="10.10.10.10"
#
# Make sure the resolver doesn't cache bogus NXDOMAIN
#
ret=0
expect="SERVFAIL"
ret=0
expect="SERVFAIL"
echo "I:exit status: $status"