tests.sh revision 801707fe19600313a0b1f7845a518100f69e58b6
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# Permission to use, copy, modify, and/or distribute this software for any
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# purpose with or without fee is hereby granted, provided that the above
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# copyright notice and this permission notice appear in all copies.
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
801707fe19600313a0b1f7845a518100f69e58b6Evan Hunt# PERFORMANCE OF THIS SOFTWARE.
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"