Commit d370da2498 for bind

commit d370da24980b734f9ddb23fa5966ce91e6cd5380
Author: Štěpán Balážik <stepan@isc.org>
Date:   Mon Oct 26 10:51:20 2026 +0100

    Inline the query helper of the nsec_synthesis tests

    Each test module wrapped isctest.query.create() and isctest.query.tcp()
    in a _query() helper of its own that added nothing to them.

    Assisted-by: Claude:claude-fable-5-1

diff --git a/bin/tests/system/nsec_synthesis/tests_nsec_child_next.py b/bin/tests/system/nsec_synthesis/tests_nsec_child_next.py
index daf5c4d26a..5da86ffb3e 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_child_next.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_child_next.py
@@ -72,11 +72,6 @@ def bootstrap():
     return {"DNSKEY": dnskey}


-def _query(server, qname, qtype):
-    query = isctest.query.create(qname, qtype)
-    return isctest.query.tcp(query, server)
-
-
 def _has_a(response, owner, address):
     rrset = response.get_rrset(
         response.answer, owner, dns.rdataclass.IN, dns.rdatatype.A
@@ -102,17 +97,17 @@ def _check_malicious_nsec(response, section):


 def _prime_parent_for_aggressive_nsec():
-    soa = _query(RESOLVER, F023_ZONE, "SOA")
+    soa = isctest.query.tcp(isctest.query.create(F023_ZONE, "SOA"), RESOLVER)
     isctest.check.noerror(soa)
     isctest.check.adflag(soa)

-    nsec = _query(RESOLVER, F023_ZONE, "NSEC")
+    nsec = isctest.query.tcp(isctest.query.create(F023_ZONE, "NSEC"), RESOLVER)
     isctest.check.noerror(nsec)
     isctest.check.adflag(nsec)


 def test_direct_insecure_child_nsec_next_fixture():
-    poison = _query(AUTH, POISON, "NSEC")
+    poison = isctest.query.tcp(isctest.query.create(POISON, "NSEC"), AUTH)
     isctest.check.noerror(poison)
     assert poison.flags & dns.flags.AA
     _check_malicious_nsec(poison, poison.answer)
@@ -121,12 +116,12 @@ def test_direct_insecure_child_nsec_next_fixture():
 def test_resolver_does_not_synth_from_insecure_child_nsec():
     _prime_parent_for_aggressive_nsec()

-    poison = _query(RESOLVER, POISON, "NSEC")
+    poison = isctest.query.tcp(isctest.query.create(POISON, "NSEC"), RESOLVER)
     isctest.check.noerror(poison)
     isctest.check.noadflag(poison)
     _check_malicious_nsec(poison, poison.answer)

-    response = _query(RESOLVER, TARGET, "A")
+    response = isctest.query.tcp(isctest.query.create(TARGET, "A"), RESOLVER)
     isctest.check.noerror(response)
     assert _has_a(response, TARGET, TARGET_A), response.to_text()
     isctest.check.adflag(response)
diff --git a/bin/tests/system/nsec_synthesis/tests_nsec_exact_nodata.py b/bin/tests/system/nsec_synthesis/tests_nsec_exact_nodata.py
index 0fd5e51d5e..0d07e480d1 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_exact_nodata.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_exact_nodata.py
@@ -69,11 +69,6 @@ def bootstrap():
     return {"DNSKEY": dnskey}


-def _query(server, qname, qtype, cd=False, dnssec=True):
-    query = isctest.query.create(qname, qtype, cd=cd, dnssec=dnssec)
-    return isctest.query.tcp(query, server)
-
-
 def _has_a(response, owner, address):
     rrset = response.get_rrset(
         response.answer, owner, dns.rdataclass.IN, dns.rdatatype.A
@@ -110,20 +105,20 @@ def test_pending_exact_nodata_nsec_cache_poisoning():
     victim's real A record.
     """
     # Prime the zone SOA (and the DNSKEY as a subquery) at secure trust.
-    soa = _query(RESOLVER, F004_ZONE, "SOA")
+    soa = isctest.query.tcp(isctest.query.create(F004_ZONE, "SOA"), RESOLVER)
     isctest.check.noerror(soa)
     isctest.check.adflag(soa)

     # Inject a forged NSEC owned by the victim name via a CD=1 query; it is
     # cached at pending trust on the victim node.
-    poison = _query(RESOLVER, VICTIM, "NSEC", cd=True)
+    poison = isctest.query.tcp(isctest.query.create(VICTIM, "NSEC", cd=True), RESOLVER)
     isctest.check.noerror(poison)
     isctest.check.noadflag(poison)
     _check_forged_nsec(poison, poison.answer)

     # Query the victim's A record. The pending NSEC must not be used to
     # synthesize a NODATA; the resolver fetches and validates the real A.
-    response = _query(RESOLVER, VICTIM, "A")
+    response = isctest.query.tcp(isctest.query.create(VICTIM, "A"), RESOLVER)
     isctest.check.noerror(response)
     assert _has_a(response, VICTIM, VICTIM_A), response.to_text()
     isctest.check.adflag(response)
diff --git a/bin/tests/system/nsec_synthesis/tests_nsec_pending_cd.py b/bin/tests/system/nsec_synthesis/tests_nsec_pending_cd.py
index cf7530baa7..07ee253a65 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_pending_cd.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_pending_cd.py
@@ -70,11 +70,6 @@ def bootstrap():
     return {"DNSKEY": dnskey}


-def _query(server, qname, qtype, cd=False, dnssec=True):
-    query = isctest.query.create(qname, qtype, cd=cd, dnssec=dnssec)
-    return isctest.query.tcp(query, server)
-
-
 def _has_a(response, owner, address):
     rrset = response.get_rrset(
         response.answer, owner, dns.rdataclass.IN, dns.rdatatype.A
@@ -107,18 +102,20 @@ def test_pending_trust_nsec_cd_cache_poisoning():
     F-004 Cache Poisoning via Pending-Trust NSEC in Aggressive Cache
     """
     # Step 1: Prime SOA parent (and DNSKEY as subquery)
-    soa = _query(RESOLVER, F004_ZONE, "SOA")
+    soa = isctest.query.tcp(isctest.query.create(F004_ZONE, "SOA"), RESOLVER)
     isctest.check.noerror(soa)
     isctest.check.adflag(soa)

     # Step 2: Inject Forged NSEC via CD=1 Query
-    poison = _query(RESOLVER, ATTACKER, "NSEC", cd=True)
+    poison = isctest.query.tcp(
+        isctest.query.create(ATTACKER, "NSEC", cd=True), RESOLVER
+    )
     isctest.check.noerror(poison)
     isctest.check.noadflag(poison)
     _check_attacker_nsec(poison, poison.answer)

     # Step 3: Exploit Against Victim Domain
-    response = _query(RESOLVER, VICTIM, "A")
+    response = isctest.query.tcp(isctest.query.create(VICTIM, "A"), RESOLVER)
     isctest.check.noerror(response)
     assert _has_a(response, VICTIM, VICTIM_A), response.to_text()
     isctest.check.adflag(response)
@@ -130,7 +127,9 @@ def test_pending_trust_nsec_cd_cache_poisoning():
     )

     # Step 4: Exploit Against Stub Client
-    response = _query(RESOLVER, VICTIM, "A", dnssec=False)
+    response = isctest.query.tcp(
+        isctest.query.create(VICTIM, "A", dnssec=False), RESOLVER
+    )
     isctest.check.noerror(response)
     assert _has_a(response, VICTIM, VICTIM_A), response.to_text()
     isctest.check.adflag(response)
diff --git a/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py b/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
index 758114bb60..3378fab356 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
@@ -88,11 +88,6 @@ victim A {VICTIM_A}
     }


-def _query(server, qname, qtype):
-    query = isctest.query.create(qname, qtype)
-    return isctest.query.tcp(query, server)
-
-
 def _has_a(response, owner, address):
     rrset = response.get_rrset(
         response.answer, owner, dns.rdataclass.IN, dns.rdatatype.A
@@ -119,19 +114,19 @@ def _check_child_self_loop_nsec(response):


 def test_direct_child_self_loop_nsec_fixture():
-    response = _query(AUTH, PROBE, "A")
+    response = isctest.query.tcp(isctest.query.create(PROBE, "A"), AUTH)
     isctest.check.nxdomain(response)
     assert response.flags & dns.flags.AA
     _check_child_self_loop_nsec(response)


 def test_resolver_does_not_synth_parent_nxdomain_from_child_nsec():
-    poison = _query(RESOLVER, PROBE, "A")
+    poison = isctest.query.tcp(isctest.query.create(PROBE, "A"), RESOLVER)
     isctest.check.nxdomain(poison)
     isctest.check.adflag(poison)
     _check_child_self_loop_nsec(poison)

-    response = _query(RESOLVER, VICTIM, "A")
+    response = isctest.query.tcp(isctest.query.create(VICTIM, "A"), RESOLVER)
     isctest.check.noerror(response)
     assert _has_a(response, VICTIM, VICTIM_A), response.to_text()
     isctest.check.adflag(response)