From: Alessio Podda Date: Thu, 9 Jul 2026 12:26:46 +0000 (+0200) Subject: Add test for mirror zone additional data X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d8813ab26e115af7c34d92069b74295a7e4619d;p=thirdparty%2Fbind9.git Add test for mirror zone additional data Existing mirror-zone system tests only covered referral glue. With this commit, we add a test that also checks for non-glue additional data. --- diff --git a/bin/tests/system/mirror/tests_mirror_additionalauth.py b/bin/tests/system/mirror/tests_mirror_additionalauth.py new file mode 100644 index 00000000000..add2469ef70 --- /dev/null +++ b/bin/tests/system/mirror/tests_mirror_additionalauth.py @@ -0,0 +1,72 @@ +# 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 re import compile as Re + +import dns.name +import dns.rdataclass +import dns.rdatatype +import dns.rrset +import pytest + +import isctest + +pytestmark = pytest.mark.extra_artifacts( + [ + "ns*/db-*", + "ns*/dsset-*", + "ns*/jn-*", + "ns*/K*", + "ns*/*.conf", + "ns*/*.db", + "ns*/*.jnl", + "ns*/*.mirror", + "ns*/*.nzf*", + "ns*/*.nzd*", + "ns*/*.signed", + ] +) + + +def _rrset(response, section, owner, rdtype): + return response.get_rrset( + section, + dns.name.from_text(owner), + dns.rdataclass.IN, + rdtype, + ) + + +def test_mirror_zone_ns_answer_adds_in_zone_address(ns3): + with ns3.watch_log_from_start() as watcher: + watcher.wait_for_line(Re(r"zone verify-csk/IN: mirror zone is now in use")) + + query = isctest.query.create("verify-csk.", "NS", dnssec=False, rd=False, ad=False) + response = isctest.query.udp(query, ns3.ip, source="10.53.0.1") + + isctest.check.noerror(response) + isctest.check.noaaflag(response) + + answer = _rrset(response, response.answer, "verify-csk.", dns.rdatatype.NS) + expected_answer = dns.rrset.from_text( + "verify-csk.", 3600, "IN", "NS", "ns2.verify-csk." + ) + assert answer is not None, response.to_text() + isctest.check.rrsets_equal(answer, expected_answer) + + additional = _rrset( + response, response.additional, "ns2.verify-csk.", dns.rdatatype.A + ) + expected_additional = dns.rrset.from_text( + "ns2.verify-csk.", 3600, "IN", "A", "10.53.0.2" + ) + assert additional is not None, response.to_text() + isctest.check.rrsets_equal(additional, expected_additional)