From: Nicki Křížek Date: Wed, 7 Jan 2026 15:31:37 +0000 (+0100) Subject: Renumber ans7->ans6 and ans8->ans7 in digdelv test X-Git-Tag: v9.21.18~32^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b63187a99b00ffc272612247a2ce5eba84fb71b;p=thirdparty%2Fbind9.git Renumber ans7->ans6 and ans8->ans7 in digdelv test Since there was no 10.53.0.6 server in the test, renumber the remaining ones so that there's no gap in the server names. This commit simply moves the ans.py files without any changes and renumbers the IP addresses in tests. --- diff --git a/bin/tests/system/digdelv/ans6/ans.py b/bin/tests/system/digdelv/ans6/ans.py new file mode 100644 index 00000000000..77e71415907 --- /dev/null +++ b/bin/tests/system/digdelv/ans6/ans.py @@ -0,0 +1,40 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# 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 https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +from typing import AsyncGenerator + +import dns.opcode +import dns.rcode + +from isctest.asyncserver import ( + AsyncDnsServer, + DnsResponseSend, + ResponseHandler, + QueryContext, +) + + +class ReplyUpdateHandler(ResponseHandler): + async def get_responses( + self, qctx: QueryContext + ) -> AsyncGenerator[DnsResponseSend, None]: + qctx.response.set_opcode(dns.opcode.UPDATE) + yield DnsResponseSend(qctx.response) + + +def main() -> None: + server = AsyncDnsServer(default_aa=True, default_rcode=dns.rcode.NOERROR) + server.install_response_handler(ReplyUpdateHandler()) + server.run() + + +if __name__ == "__main__": + main() diff --git a/bin/tests/system/digdelv/ans7/ans.py b/bin/tests/system/digdelv/ans7/ans.py index 77e71415907..d959b597e23 100644 --- a/bin/tests/system/digdelv/ans7/ans.py +++ b/bin/tests/system/digdelv/ans7/ans.py @@ -11,28 +11,64 @@ from typing import AsyncGenerator -import dns.opcode +import dns import dns.rcode from isctest.asyncserver import ( AsyncDnsServer, + CloseConnection, DnsResponseSend, - ResponseHandler, + DomainHandler, + IgnoreAllQueries, QueryContext, + ResponseAction, + ResponseDrop, ) -class ReplyUpdateHandler(ResponseHandler): +class SilentHandler(DomainHandler, IgnoreAllQueries): + """Handler that doesn't respond.""" + + domains = ["silent.example"] + + +class CloseHandler(DomainHandler): + """Handler that doesn't respond and closes TCP connection.""" + + domains = ["close.example"] + + async def get_responses( + self, qctx: QueryContext + ) -> AsyncGenerator[ResponseAction, None]: + yield CloseConnection() + + +class SilentThenServfailHandler(DomainHandler): + """Handler that drops one query and response to the next one with SERVFAIL.""" + + domains = ["silent-then-servfail.example"] + counter = 0 + async def get_responses( self, qctx: QueryContext - ) -> AsyncGenerator[DnsResponseSend, None]: - qctx.response.set_opcode(dns.opcode.UPDATE) - yield DnsResponseSend(qctx.response) + ) -> AsyncGenerator[ResponseAction, None]: + if self.counter % 2 == 0: + yield ResponseDrop() + else: + qctx.response.set_rcode(dns.rcode.SERVFAIL) + yield DnsResponseSend(qctx.response, authoritative=False) + self.counter += 1 def main() -> None: - server = AsyncDnsServer(default_aa=True, default_rcode=dns.rcode.NOERROR) - server.install_response_handler(ReplyUpdateHandler()) + server = AsyncDnsServer() + server.install_response_handlers( + [ + CloseHandler(), + SilentHandler(), + SilentThenServfailHandler(), + ] + ) server.run() diff --git a/bin/tests/system/digdelv/ans8/ans.py b/bin/tests/system/digdelv/ans8/ans.py deleted file mode 100644 index d959b597e23..00000000000 --- a/bin/tests/system/digdelv/ans8/ans.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# SPDX-License-Identifier: MPL-2.0 -# -# 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 https://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -from typing import AsyncGenerator - -import dns -import dns.rcode - -from isctest.asyncserver import ( - AsyncDnsServer, - CloseConnection, - DnsResponseSend, - DomainHandler, - IgnoreAllQueries, - QueryContext, - ResponseAction, - ResponseDrop, -) - - -class SilentHandler(DomainHandler, IgnoreAllQueries): - """Handler that doesn't respond.""" - - domains = ["silent.example"] - - -class CloseHandler(DomainHandler): - """Handler that doesn't respond and closes TCP connection.""" - - domains = ["close.example"] - - async def get_responses( - self, qctx: QueryContext - ) -> AsyncGenerator[ResponseAction, None]: - yield CloseConnection() - - -class SilentThenServfailHandler(DomainHandler): - """Handler that drops one query and response to the next one with SERVFAIL.""" - - domains = ["silent-then-servfail.example"] - counter = 0 - - async def get_responses( - self, qctx: QueryContext - ) -> AsyncGenerator[ResponseAction, None]: - if self.counter % 2 == 0: - yield ResponseDrop() - else: - qctx.response.set_rcode(dns.rcode.SERVFAIL) - yield DnsResponseSend(qctx.response, authoritative=False) - self.counter += 1 - - -def main() -> None: - server = AsyncDnsServer() - server.install_response_handlers( - [ - CloseHandler(), - SilentHandler(), - SilentThenServfailHandler(), - ] - ) - server.run() - - -if __name__ == "__main__": - main() diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index c07ed392c09..31360dd3424 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -76,7 +76,7 @@ $PYTHON -c "import yaml" 2>/dev/null && HAS_PYYAML=1 n=$((n + 1)) echo_i "check nslookup handles UPDATE response ($n)" ret=0 -"$NSLOOKUP" -q=CNAME -timeout=1 "-port=$PORT" foo.bar 10.53.0.7 >nslookup.out.test$n 2>&1 && ret=1 +"$NSLOOKUP" -q=CNAME -timeout=1 "-port=$PORT" foo.bar 10.53.0.6 >nslookup.out.test$n 2>&1 && ret=1 grep "Opcode mismatch" nslookup.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -84,7 +84,7 @@ status=$((status + ret)) n=$((n + 1)) echo_i "check host handles UPDATE response ($n)" ret=0 -"$HOST" -W 1 -t CNAME -p $PORT foo.bar 10.53.0.7 >host.out.test$n 2>&1 && ret=1 +"$HOST" -W 1 -t CNAME -p $PORT foo.bar 10.53.0.6 >host.out.test$n 2>&1 && ret=1 grep "Opcode mismatch" host.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -94,7 +94,7 @@ echo_i "check nsupdate handles UPDATE response to QUERY ($n)" ret=0 res=0 $NSUPDATE <nsupdate.out.test$n 2>&1 || res=$? -server 10.53.0.7 ${PORT} +server 10.53.0.6 ${PORT} add x.example.com 300 in a 1.2.3.4 send EOF @@ -107,7 +107,7 @@ if [ -x "$DIG" ]; then n=$((n + 1)) echo_i "check dig handles UPDATE response ($n)" ret=0 - dig_with_opts @10.53.0.7 +tries=1 +timeout=1 cname foo.bar >dig.out.test$n 2>&1 && ret=1 + dig_with_opts @10.53.0.6 +tries=1 +timeout=1 cname foo.bar >dig.out.test$n 2>&1 && ret=1 grep "Opcode mismatch" dig.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -1276,7 +1276,7 @@ if [ -x "$DIG" ]; then n=$((n + 1)) echo_i "check that dig handles UDP timeout followed by a SERVFAIL correctly ($n)" ret=0 - dig_with_opts +timeout=1 +nofail @10.53.0.8 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1 + dig_with_opts +timeout=1 +nofail @10.53.0.7 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1 grep -F "status: SERVFAIL" dig.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -1284,7 +1284,7 @@ if [ -x "$DIG" ]; then n=$((n + 1)) echo_i "check that dig handles TCP timeout followed by a SERVFAIL correctly ($n)" ret=0 - dig_with_opts +timeout=1 +nofail +tcp @10.53.0.8 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1 + dig_with_opts +timeout=1 +nofail +tcp @10.53.0.7 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1 grep -F "status: SERVFAIL" dig.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -1318,7 +1318,7 @@ if [ -x "$DIG" ]; then n=$((n + 1)) echo_i "check that dig tries the next server after a TCP socket read error ($n)" ret=0 - dig_with_opts +tcp @10.53.0.8 @10.53.0.3 close.example >dig.out.test$n 2>&1 || ret=1 + dig_with_opts +tcp @10.53.0.7 @10.53.0.3 close.example >dig.out.test$n 2>&1 || ret=1 grep -F "status: NOERROR" dig.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -1341,7 +1341,7 @@ if [ -x "$DIG" ]; then n=$((n + 1)) echo_i "check that dig tries the next server after UDP socket read timeouts ($n)" ret=0 - dig_with_opts +timeout=1 @10.53.0.8 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1 + dig_with_opts +timeout=1 @10.53.0.7 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1 grep -F "status: NOERROR" dig.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -1349,7 +1349,7 @@ if [ -x "$DIG" ]; then n=$((n + 1)) echo_i "check that dig tries the next server after TCP socket read timeouts ($n)" ret=0 - dig_with_opts +timeout=1 +tcp @10.53.0.8 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1 + dig_with_opts +timeout=1 +tcp @10.53.0.7 @10.53.0.3 silent.example >dig.out.test$n 2>&1 || ret=1 grep -F "status: NOERROR" dig.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) @@ -1358,7 +1358,7 @@ if [ -x "$DIG" ]; then n=$((n + 1)) echo_i "check that dig correctly refuses to use a server with a IPv4 mapped IPv6 address after failing with a regular IP address ($n)" ret=0 - dig_with_opts @10.53.0.8 @::ffff:10.53.0.8 silent.example >dig.out.test$n 2>&1 || ret=1 + dig_with_opts @10.53.0.7 @::ffff:10.53.0.7 silent.example >dig.out.test$n 2>&1 || ret=1 grep -F ";; Skipping mapped address" dig.out.test$n >/dev/null || ret=1 grep -F ";; No acceptable nameservers" dig.out.test$n >/dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi