From: Ondřej Surý Date: Wed, 7 Nov 2018 18:21:13 +0000 (+0700) Subject: Add system tests for {min,max}-{cache,ncache}-ttl X-Git-Tag: v9.13.4~28^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6ca532df462b0fd8960e21e53d2f46496a6839b;p=thirdparty%2Fbind9.git Add system tests for {min,max}-{cache,ncache}-ttl --- diff --git a/bin/tests/system/Makefile.in b/bin/tests/system/Makefile.in index 6a4309905f5..fcc32539cab 100644 --- a/bin/tests/system/Makefile.in +++ b/bin/tests/system/Makefile.in @@ -69,7 +69,7 @@ PARALLEL = rpzrecurse serve-stale dnssec \ rrchecker rrl rrsetorder rsabigexponent runtime \ sfcache smartsign sortlist \ spf staticstub statistics statschannel stub synthfromdnssec \ - tcp tools tsig tsiggss \ + tcp tools tsig tsiggss ttl \ unknown upforwd verify views wildcard \ xfer xferquota zero zonechecks diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 8bb5a7f4282..7519e9d9b92 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -102,7 +102,7 @@ PARALLELDIRS="acl additional addzone allow-query auth autosign \ rrchecker rrl rrsetorder rsabigexponent runtime \ serve-stale sfcache smartsign sortlist \ spf staticstub statistics statschannel stub synthfromdnssec \ - tcp tools tsig tsiggss \ + tcp tools tsig tsiggss ttl \ unknown upforwd verify views wildcard \ xfer xferquota zero zonechecks" diff --git a/bin/tests/system/conf.sh.win32 b/bin/tests/system/conf.sh.win32 index b8010f54308..c7910071109 100644 --- a/bin/tests/system/conf.sh.win32 +++ b/bin/tests/system/conf.sh.win32 @@ -100,7 +100,7 @@ SEQUENTIALDIRS="acl additional addzone autosign builtin \ reclimit redirect resolver rndc rpz rrchecker rrl \ rrsetorder rsabigexponent runtime sfcache smartsign sortlist \ spf staticstub statistics statschannel stub tcp tkey tsig \ - tsiggss unknown upforwd verify views wildcard xfer xferquota \ + tsiggss ttl unknown upforwd verify views wildcard xfer xferquota \ zero zonechecks" # List of tests that use unique ports (other than 5300 and 9953). These diff --git a/bin/tests/system/ttl/clean.sh b/bin/tests/system/ttl/clean.sh new file mode 100644 index 00000000000..0f928d68631 --- /dev/null +++ b/bin/tests/system/ttl/clean.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. ../conf.sh + +rm -f ./dig.out.* +rm -f ./*/named.conf +rm -f ./*/named.memstats +rm -f ./*/named.run +rm -f ./ns*/named.lock +rm -f ./ns*/_default.nzf +rm -f ./ns*/_default.nzd* +rm -f ./ns*/managed-keys.bind* ns*/*.mkeys* diff --git a/bin/tests/system/ttl/ns1/max-example.db b/bin/tests/system/ttl/ns1/max-example.db new file mode 100644 index 00000000000..87efa578c24 --- /dev/null +++ b/bin/tests/system/ttl/ns1/max-example.db @@ -0,0 +1,9 @@ +max-example. 1209600 IN SOA ns root ( + 2000082401 ; serial + 1800 ; refresh (30 minutes) + 1800 ; retry (30 minutes) + 1814400 ; expire (3 weeks) + 1209600 ; minimum (2 weeks) + ) +max-example. 1209600 IN NS ns.max-example. +ns.max-example. 1209600 IN A 10.53.0.1 diff --git a/bin/tests/system/ttl/ns1/min-example.db b/bin/tests/system/ttl/ns1/min-example.db new file mode 100644 index 00000000000..da1db00f1ba --- /dev/null +++ b/bin/tests/system/ttl/ns1/min-example.db @@ -0,0 +1,9 @@ +min-example. 0 IN SOA ns root ( + 2000082401 ; serial + 1800 ; refresh (30 minutes) + 1800 ; retry (30 minutes) + 1814400 ; expire (3 weeks) + 0 ; minimum (0 seconds) + ) +min-example. 0 IN NS ns.min-example. +ns.min-example. 0 IN A 10.53.0.1 diff --git a/bin/tests/system/ttl/ns1/named.conf.in b/bin/tests/system/ttl/ns1/named.conf.in new file mode 100644 index 00000000000..211d9591bb0 --- /dev/null +++ b/bin/tests/system/ttl/ns1/named.conf.in @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-sha256; +}; + +controls { + inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; +}; + +options { + query-source address 10.53.0.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; + check-integrity no; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +zone "min-example" { + type master; + file "min-example.db"; +}; + +zone "max-example" { + type master; + file "max-example.db"; +}; diff --git a/bin/tests/system/ttl/ns2/hints.db b/bin/tests/system/ttl/ns2/hints.db new file mode 100644 index 00000000000..348fc96c11d --- /dev/null +++ b/bin/tests/system/ttl/ns2/hints.db @@ -0,0 +1,2 @@ +. 60 IN NS ns.nil. +ns.nil. 60 IN A 10.53.0.1 diff --git a/bin/tests/system/ttl/ns2/named.conf.in b/bin/tests/system/ttl/ns2/named.conf.in new file mode 100644 index 00000000000..0762625492b --- /dev/null +++ b/bin/tests/system/ttl/ns2/named.conf.in @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +options { + directory "."; + query-source address 10.53.0.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + servfail-ttl 0; + max-recursion-depth 12; + recursion yes; + dnssec-validation no; + min-cache-ttl 60; + min-ncache-ttl 30; + max-cache-ttl 120; + max-ncache-ttl 60; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-sha256; +}; + +controls { + inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; +}; + +zone "." { type hint; file "hints.db"; }; diff --git a/bin/tests/system/ttl/setup.sh b/bin/tests/system/ttl/setup.sh new file mode 100644 index 00000000000..68fd0d2b814 --- /dev/null +++ b/bin/tests/system/ttl/setup.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +. ../conf.sh + +$SHELL clean.sh +copy_setports ns1/named.conf.in ns1/named.conf +copy_setports ns2/named.conf.in ns2/named.conf diff --git a/bin/tests/system/ttl/tests.sh b/bin/tests/system/ttl/tests.sh new file mode 100644 index 00000000000..e0a3582b7f5 --- /dev/null +++ b/bin/tests/system/ttl/tests.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +. ../conf.sh + +dig_with_options() { "$DIG" +noadd +nosea +nostat +noquest +nocomm +nocmd -p "${PORT}" "$@"; } + +status=0 +t=0 + +echo_i "testing min-cache-ttl" +t=$((t+1)) +dig_with_options IN SOA min-example. @10.53.0.2 > dig.out.${t} +TTL=$(< dig.out.${t} awk '{ print $2; }') +[ "$TTL" -eq 60 ] || status=$((status+1)) + +echo_i "testing min-ncache-ttl" +t=$((t+1)) +dig_with_options IN MX min-example. @10.53.0.2 > dig.out.${t} +TTL=$(< dig.out.${t} awk '{ print $2; }') +[ "$TTL" -eq 30 ] || status=$((status+1)) + +echo_i "testing max-cache-ttl" +t=$((t+1)) +dig_with_options IN SOA max-example. @10.53.0.2 > dig.out.${t} +TTL=$(< dig.out.${t} awk '{ print $2; }') +[ "$TTL" -eq 120 ] || status=$((status+1)) + +echo_i "testing max-ncache-ttl" +t=$((t+1)) +dig_with_options IN MX max-example. @10.53.0.2 > dig.out.${t} +TTL=$(< dig.out.${t} awk '{ print $2; }') +[ "$TTL" -eq 60 ] || status=$((status+1)) + +echo_i "exit status: $status" +[ $status -eq 0 ] || exit 1 diff --git a/util/copyrights b/util/copyrights index 2e7b79a6f38..14bdcaba533 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1089,6 +1089,14 @@ ./bin/tests/system/tsiggss/prereq.sh SH 2010,2011,2012,2014,2016,2018 ./bin/tests/system/tsiggss/setup.sh SH 2010,2011,2012,2014,2016,2017,2018 ./bin/tests/system/tsiggss/tests.sh SH 2010,2011,2014,2016,2017,2018 +./bin/tests/system/ttl/clean.sh X 2018 +./bin/tests/system/ttl/ns1/max-example.db X 2018 +./bin/tests/system/ttl/ns1/min-example.db X 2018 +./bin/tests/system/ttl/ns1/named.conf.in X 2018 +./bin/tests/system/ttl/ns2/hints.db X 2018 +./bin/tests/system/ttl/ns2/named.conf.in X 2018 +./bin/tests/system/ttl/setup.sh X 2018 +./bin/tests/system/ttl/tests.sh X 2018 ./bin/tests/system/unknown/clean.sh SH 2000,2001,2004,2007,2012,2013,2014,2015,2016,2018 ./bin/tests/system/unknown/large.out X 2012,2018 ./bin/tests/system/unknown/ns3/sign.sh SH 2012,2014,2016,2017,2018