tests.sh revision 2fee8782a6fd57d86a67949092ab9197111af390
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
2fee8782a6fd57d86a67949092ab9197111af390Evan Hunt# This Source Code Form is subject to the terms of the Mozilla Public
2fee8782a6fd57d86a67949092ab9197111af390Evan Hunt# License, v. 2.0. If a copy of the MPL was not distributed with this
2fee8782a6fd57d86a67949092ab9197111af390Evan Hunt# file, You can obtain one at http://mozilla.org/MPL/2.0/.
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:querying for non-existing zone data ($n)"
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt$DIG $DIGOPTS @10.53.0.1 -p 5300 a.added.example a > dig.out.ns1.$n || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntgrep 'status: REFUSED' dig.out.ns1.$n > /dev/null || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:adding a new zone into default NZD using rndc addzone ($n)"
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 addzone "added.example { type master; file \"added.db\"; };" 2>&1 | sed 's/^/I:ns1 /';
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:querying for existing zone data ($n)"
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt$DIG $DIGOPTS @10.53.0.1 -p 5300 a.added.example a > dig.out.ns1.$n || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntgrep 'status: NOERROR' dig.out.ns1.$n > /dev/null || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:stopping ns1"
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:dumping _default.nzd to _default.nzf ($n)"
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt$NZD2NZF ns1/_default.nzd > ns1/_default.nzf || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:checking that _default.nzf contains the expected content ($n)"
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntgrep 'zone added.example { type master; file "added.db"; };' ns1/_default.nzf > /dev/null || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:deleting _default.nzd database"
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:starting ns1 which should migrate the .nzf to .nzd"
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt$PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:querying for zone data from migrated zone config ($n)"
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt$DIG $DIGOPTS @10.53.0.1 -p 5300 a.added.example a > dig.out.ns1.$n || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntgrep 'status: NOERROR' dig.out.ns1.$n > /dev/null || ret=1
801707fe19600313a0b1f7845a518100f69e58b6Evan Huntecho "I:exit status: $status"