]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Count distinct destinations in selfpointedglue dnstap checks
authorMichal Nowak <mnowak@isc.org>
Tue, 2 Jun 2026 14:53:25 +0000 (14:53 +0000)
committerMichal Nowak <mnowak@isc.org>
Wed, 10 Jun 2026 19:15:09 +0000 (19:15 +0000)
Tolerates retransmissions, which would inflate a raw line count.

Assisted-by: Claude:claude-opus-4-8
bin/tests/system/selfpointedglue/tests_selfpointedglue.py

index d559b76ea8284bc8c60b276ceeef84a0b3d8cc5a..3f42f752ed1ccfc9c805b0799231cc3d00588355 100644 (file)
@@ -33,8 +33,11 @@ def extract_dnstap(ns, expectedlen):
     )
 
     lines = dnstapread.out.splitlines()
-    assert expectedlen == len(lines)
-    return list(map(line_to_ips_and_queries, lines))
+    # Count distinct (destination, query) pairs, not raw lines: under load
+    # named may retransmit, adding identical entries.
+    ips_and_queries = list(dict.fromkeys(map(line_to_ips_and_queries, lines)))
+    assert expectedlen == len(ips_and_queries)
+    return ips_and_queries
 
 
 # Because DNSTAP doesn't have ordering guarantee, the order doesn't matter here.
@@ -65,7 +68,7 @@ def test_selfpointedglue1(ns4):
     isctest.check.servfail(res)
 
     # 4 queries to get to the delegation.
-    # 13 queries to delegation NS servers.
+    # 13 queries to delegation NS servers (13 distinct destinations).
     ips_and_queries = extract_dnstap(ns4, 17)
 
     # Thanks to the de-duplication, only the first 13 NS IPs are
@@ -87,9 +90,9 @@ def test_selfpointedglue1(ns4):
             ("10.53.1.1", "a.sub.example.tld/IN/A"),
             ("10.53.1.2", "a.sub.example.tld/IN/A"),
             ("10.53.2.1", "a.sub.example.tld/IN/A"),
-            ("10.53.0.3", "a.sub.example.tld/IN/A"),
             ("127.0.0.1", "a.sub.example.tld/IN/A"),
             ("127.0.0.2", "a.sub.example.tld/IN/A"),
+            ("127.0.0.3", "a.sub.example.tld/IN/A"),
         ],
         ips_and_queries,
     )