tests.sh revision 32148399a2d4476e8246cea601d882b578ad1c82
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# Permission to use, copy, modify, and/or distribute this software for any
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# purpose with or without fee is hereby granted, provided that the above
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# copyright notice and this permission notice appear in all copies.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# PERFORMANCE OF THIS SOFTWARE.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# $Id: tests.sh,v 1.4.154.1 2012/01/04 20:05:03 smann Exp $
0c310d16b05ee94743d33f6920907edee6084fc8Michael GraffDIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
3761c433912beabe43abeed2c3513b6201c59f64Mark AndrewsRNDCCMD="$RNDC -s 10.53.0.2 -p 9953 -c ../common/rndc.conf"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:preparing ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsserver 10.53.0.2
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsupdate add text1.nil. 600 IN TXT "addition 1"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text1.other. 600 IN TXT "addition 1"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:rndc freeze"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking zone was dumped ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsgrep "addition 1" ns2/nil.db > /dev/null 2>&1 || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking journal file is still present ($n)"
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsecho "I:checking zone not writable ($n)"
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END && ret=1
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsserver 10.53.0.2
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsupdate add text2.nil. 600 IN TXT "addition 2"
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews$DIGCMD text2.nil. TXT | grep 'addition 2' >/dev/null && ret=1
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsecho "I:rndc thaw"
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrewsecho "I:checking zone now writable ($n)"
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsserver 10.53.0.2
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text3.nil. 600 IN TXT "addition 3"
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$DIGCMD text3.nil. TXT | grep 'addition 3' >/dev/null || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsecho "I:rndc sync"
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsecho "I:checking zone was dumped ($n)"
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsgrep "addition 3" ns2/nil.db > /dev/null 2>&1 || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsecho "I:checking journal file is still present ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:checking zone is still writable ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsserver 10.53.0.2
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsupdate add text4.nil. 600 IN TXT "addition 4"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:rndc sync -clean"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:checking zone was dumped ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "addition 4" ns2/nil.db > /dev/null 2>&1 || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "I:checking journal file is deleted ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "I:checking zone is still writable ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsserver 10.53.0.2
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsupdate add text5.nil. 600 IN TXT "addition 5"
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "I:checking other journal files not removed ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:cleaning all zones ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking all journals removed ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking that freezing static zones is not allowed ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDCCMD freeze static 2>&1 | grep 'not dynamic' > /dev/null || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:checking that journal is removed when serial is changed before thaw ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserver 10.53.0.2
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text6.other. 600 IN TXT "addition 6"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserial=`awk '$3 == "serial" {print $1}' ns2/other.db`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssed s/$serial/$newserial/ ns2/other.db > ns2/other.db.new
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho 'frozen TXT "frozen addition"' >> ns2/other.db.new
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsserver 10.53.0.2
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsupdate add text7.other. 600 IN TXT "addition 7"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD text6.other. TXT | grep 'addition 6' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD text7.other. TXT | grep 'addition 7' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD frozen.other. TXT | grep 'frozen addition' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking that journal is kept when ixfr-from-differences is in use ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserver 10.53.0.2
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text6.nil. 600 IN TXT "addition 6"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserial=`awk '$3 == "serial" {print $1}' ns2/nil.db`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssed s/$serial/$newserial/ ns2/nil.db > ns2/nil.db.new
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho 'frozen TXT "frozen addition"' >> ns2/nil.db.new
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserver 10.53.0.2
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text7.nil. 600 IN TXT "addition 7"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews$DIGCMD text6.nil. TXT | grep 'addition 6' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD text7.nil. TXT | grep 'addition 7' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD frozen.nil. TXT | grep 'frozen addition' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:dumping stats ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I: verifying adb records in named.stats ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsgrep "ADB stats" ns2/named.stats > /dev/null || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:test using second key ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.2 -p 9953 -c ns2/secondkey.conf status > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:test 'rndc dumpdb' on a empty cache ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf dumpdb > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews grep "Dump complete" ns3/named_dump.db > /dev/null || tmp=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:test 'rndc reload' on a zone with include files ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsgrep "incl/IN: skipping load" ns2/named.run > /dev/null && ret=1
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halleyloads=`grep "incl/IN: starting load" ns2/named.run | wc -l`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.2 -p 9953 -c ../common/rndc.conf reload > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews grep "incl/IN: skipping load" ns2/named.run > /dev/null || tmp=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.2 -p 9953 -c ../common/rndc.conf reload > /dev/null || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews loads=`grep "incl/IN: starting load" ns2/named.run | wc -l`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with hmac-md5 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9951 -c ns4/key1.conf status > /dev/null 2>&1 || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews $RNDC -s 10.53.0.4 -p 9951 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:testing rndc with hmac-sha1 ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews$RNDC -s 10.53.0.4 -p 9952 -c ns4/key2.conf status > /dev/null 2>&1 || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews $RNDC -s 10.53.0.4 -p 9952 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:testing rndc with hmac-sha224 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9953 -c ns4/key3.conf status > /dev/null 2>&1 || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews $RNDC -s 10.53.0.4 -p 9953 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with hmac-sha256 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9954 -c ns4/key4.conf status > /dev/null 2>&1 || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews $RNDC -s 10.53.0.4 -p 9954 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:testing rndc with hmac-sha384 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9955 -c ns4/key5.conf status > /dev/null 2>&1 || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews $RNDC -s 10.53.0.4 -p 9955 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with hmac-sha512 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > /dev/null 2>&1 || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews $RNDC -s 10.53.0.4 -p 9956 -c ns4/key${i}.conf status > /dev/null 2>&1 2>&1 && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing automatic zones are reported ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > rndc.output.test$n || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsgrep "number of zones: 198 (196 automatic)" rndc.output.test$n > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with null command ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with unknown control channel command ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf obviouslynotacommand >/dev/null 2>&1 && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews# rndc: 'obviouslynotacommand' failed: unknown command
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc with querylog command ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews# first enable it with querylog on option
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf querylog on >/dev/null 2>&1 || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews# query for builtin and check if query was logged
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$DIG @10.53.0.4 -p 5300 -c ch -t txt foo12345.bind > /dev/null || ret 1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query logging is now on" ns4/named.run > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query: foo12345.bind CH TXT" ns4/named.run > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews# toggle query logging and check again
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf querylog > /dev/null 2>&1 || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews# query for another builtin zone and check if query was logged
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$DIG @10.53.0.4 -p 5300 -c ch -t txt foo9876.bind > /dev/null || ret 1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query logging is now off" ns4/named.run > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query: foo9876.bind CH TXT" ns4/named.run > /dev/null && ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc nta time limits ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 2h nta1.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 1d nta2.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 1w nta3.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 8d nta4.example 2>&1 | grep "NTA lifetime cannot exceed one week" > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsfor i in 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews echo "I:testing rndc buffer size limits (size=${i}) ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews $RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf testgen ${i} 2>&1 > rndc.output.test$n || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews if [ $actual_size != $expected_size ]; then ret=1; fi
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc -r (show result) ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r testgen 0 2>&1 > rndc.output.test$n || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "ISC_R_SUCCESS 0" rndc.output.test$n > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc with a token containing a space ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r flush '"view with a space"' 2>&1 > rndc.output.test$n || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "not found" rndc.output.test$n > /dev/null && ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:test 'rndc reconfig' with a broken config ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > rndc.output.test$n 2>&1 && ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsgrep "rndc: 'reconfig' failed: unexpected token" rndc.output.test$n > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:test read-only control channel access ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > /dev/null 2>&1 || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf nta -dump > /dev/null 2>&1 || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf reconfig > /dev/null 2>&1 && ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:test rndc status shows running on ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > rndc.output.test$n /dev/null 2>&1 || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsgrep "^running on " rndc.output.test$n > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:test 'rndc reconfig' with loading of a large zone ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewscur=`awk 'BEGIN {l=0} /^/ {l++} END { print l }' ns6/named.run`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "zone \"huge.zone\" { type master; file \"huge.zone.db\"; };" >> ns6/named.conf
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:reloading config"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > rndc.output.test$n 2>&1 || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:check if zone load was scheduled ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "scheduled loading new zones" ns6/named.run > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:check if query for the zone returns SERVFAIL ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.test$n
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "SERVFAIL" dig.out.test$n > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo " I:failed (ignored)"; ret=0; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:wait for the zones to be loaded ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews sed -n "$cur,"'$p' < ns6/named.run | grep "any newly configured zones are now loaded" > /dev/null && {
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:check if query for the zone returns NOERROR ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.test$n
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "NOERROR" dig.out.test$n > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ -x "$PYTHON" ]; then
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews echo "I:test rndc python bindings ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewssys.path.insert(0, '../../../../bin/python')
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsfrom isc import *
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsr = rndc(('10.53.0.5', 9953), 'hmac-sha256', '1234abcd8765')
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsresult = r.call('status')
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsprint(result['text'])
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews grep 'server is up and running' rndc.output.test$n > /dev/null 2>&1 || ret=1