Commit 3a239d4e3a for bind
commit 3a239d4e3a8e34f36ffa563f00fb4d33888022f5
Author: Štěpán Balážik <stepan@isc.org>
Date: Wed Sep 16 17:31:16 2026 +0200
Test that CNAME chains are followed in zone-data answers
Guard the CNAME handling introduced in 1b8ceec580: the answer to a
query for a CNAME owner carries the chain and the target's records.
Assisted-by: Claude:claude-fable-5-1
diff --git a/bin/tests/system/isctest/asyncserver/tests/zone_data/ans1/ans.py b/bin/tests/system/isctest/asyncserver/tests/zone_data/ans1/ans.py
new file mode 120000
index 0000000000..0855b69d50
--- /dev/null
+++ b/bin/tests/system/isctest/asyncserver/tests/zone_data/ans1/ans.py
@@ -0,0 +1 @@
+../../../../../ans.py
\ No newline at end of file
diff --git a/bin/tests/system/isctest/asyncserver/tests/zone_data/ans1/zones/example.db b/bin/tests/system/isctest/asyncserver/tests/zone_data/ans1/zones/example.db
new file mode 100644
index 0000000000..9256f78d37
--- /dev/null
+++ b/bin/tests/system/isctest/asyncserver/tests/zone_data/ans1/zones/example.db
@@ -0,0 +1,5 @@
+example. 300 IN SOA ns.example. hostmaster.example. 1 3600 600 86400 300
+example. 300 IN NS ns.example.
+ns.example. 300 IN A 10.53.0.1
+foo.example. 300 IN CNAME bar.example.
+bar.example. 300 IN A 192.0.2.2
diff --git a/bin/tests/system/isctest/asyncserver/tests/zone_data/tests_zone_data.py b/bin/tests/system/isctest/asyncserver/tests/zone_data/tests_zone_data.py
new file mode 100644
index 0000000000..3f0ea842ea
--- /dev/null
+++ b/bin/tests/system/isctest/asyncserver/tests/zone_data/tests_zone_data.py
@@ -0,0 +1,32 @@
+# 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.
+
+import dns.message
+import dns.rdatatype
+
+from isctest.template import ANS1
+
+import isctest
+
+
+def query(qname: str, qtype: str) -> dns.message.Message:
+ msg = isctest.query.create(qname, qtype, dnssec=False, rd=False)
+ return isctest.query.tcp(msg, ANS1.ip, timeout=3, attempts=1)
+
+
+def test_cname_chain_is_followed():
+ res = query("foo.example.", "A")
+ isctest.check.noerror(res)
+ assert [rrset.rdtype for rrset in res.answer] == [
+ dns.rdatatype.CNAME,
+ dns.rdatatype.A,
+ ]
+ assert res.answer[-1][0].to_text() == "192.0.2.2"