tests.sh revision e085624e0f4fcc7416b4b50dde9a4caf03385d65
#
# Copyright (C) 2004, 2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC")
# Copyright (C) 2000, 2001 Internet Software Consortium.
#
# 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.
# $Id: tests.sh,v 1.30 2010/11/30 23:46:55 tbox Exp $
status=0
# wait for zone transfer to complete
tries=0
while true; do
then
exit 1
fi
then
break
else
echo "I:zones are not fully loaded, waiting..."
sleep 1
fi
done
echo "I:fetching first copy of zone before update"
echo "I:fetching second copy of zone before update"
echo "I:comparing pre-update copies to known good data"
echo "I:updating zone"
# nsupdate will print a ">" prompt to stdout as it gets each input line.
server 10.53.0.1 5300
update add updated.example.nil. 600 A 10.10.10.1
update add updated.example.nil. 600 TXT Foo
update delete t.example.nil.
END
echo "I:sleeping 5 seconds for server to incorporate changes"
sleep 5
echo "I:fetching first copy of zone after update"
echo "I:fetching second copy of zone after update"
echo "I:comparing post-update copies to known good data"
echo "I:testing local update policy"
echo "I:updating zone"
# nsupdate will print a ">" prompt to stdout as it gets each input line.
zone other.nil.
update add new.other.nil. 600 IN A 10.10.10.1
send
END
echo "I:sleeping 5 seconds for server to incorporate changes"
sleep 5
echo "I:checking result of update"
echo "I:comparing post-update copy to known good data"
echo "I:testing zone consistency checks"
# inserting an NS record without a corresponding A or AAAA record should fail
update add other.nil. 600 in ns ns3.other.nil.
send
END
# ...but should work if an A record is inserted first:
update add ns4.other.nil 600 in a 10.53.0.1
send
update add other.nil. 600 in ns ns4.other.nil.
send
END
# ...or if an AAAA record does:
update add ns5.other.nil 600 in aaaa 2001:db8::1
send
update add other.nil. 600 in ns ns5.other.nil.
send
END
update add other.nil. 600 in ns ns6.other.nil.
update add ns6.other.nil 600 in a 10.53.0.1
send
END
echo "I:sleeping 5 seconds for server to incorporate changes"
sleep 5
echo "I:checking result of update"
then
echo "I:running update.pl test"
else
echo "I:The second part of this test requires the Net::DNS library." >&2
fi
echo "I:fetching first copy of test zone"
echo "I:fetching second copy of test zone"
echo "I:comparing zones"
echo "I:SIGKILL and restart server ns1"
cd ns1
cd ..
sleep 10
if
then
echo "I:restarted server ns1"
else
echo "I:could not restart server ns1"
exit 1
fi
sleep 10
echo "I:fetching ns1 after hard restart"
echo "I:comparing zones"
echo "I:begin RT #482 regression test"
echo "I:update master"
server 10.53.0.1 5300
update add updated2.example.nil. 600 A 10.10.10.2
update add updated2.example.nil. 600 TXT Bar
update delete c.example.nil.
send
END
sleep 5
echo "I:SIGHUP slave"
sleep 5
echo "I:update master again"
server 10.53.0.1 5300
update add updated3.example.nil. 600 A 10.10.10.3
update add updated3.example.nil. 600 TXT Zap
update delete d.example.nil.
send
END
sleep 5
echo "I:SIGHUP slave again"
sleep 5
then
status=1
fi
echo "I:end RT #482 regression test"
echo "I:testing that rndc stop updates the master file"
server 10.53.0.1 5300
update add updated4.example.nil. 600 A 10.10.10.3
send
END
# Removing the journal file and restarting the server means
# that the data served by the new server process are exactly
# those dumped to the master file by "rndc stop".
echo "I:exit status: $status"
exit $status