Commit f518924900 for bind
commit f51892490081f42bed898af8e4dbd22dd7e92c08
Author: Štěpán Balážik <stepan@isc.org>
Date: Wed Oct 21 12:15:12 2026 +0200
Add zone records in transactions
Since dnspython 2.1.0, zones are updated through transactions, which
the tests already use to sign zones and for the verify test's apex
NSEC3 record. Adding, replacing and duplicating RRSIGs the same way
replaces editing nodes and rdatasets by hand. The generated zone files
are unchanged.
Assisted-by: Claude:claude-opus-5-5
diff --git a/bin/tests/system/dnssec_py/tests_dnskey_malformed.py b/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
index b55f0aeafa..484a990910 100644
--- a/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
+++ b/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
@@ -82,19 +82,22 @@ def bootstrap():
deterministic=False, # for OpenSSL<3.2.0 compat
)
- # force use of the malformed ZSKs for invalid-rrsig.dnskey-malformed;
- # the record only has one invalid RRSIG signed with a malformed ZSK
- invalid_rrset = zoneobj.get_rdataset("invalid-rrsig", "RRSIG", "A")
- rr = invalid_rrset.pop()
- invalid_rrset.add(create_malformed_rr(rr))
-
- # multiple-rrsigs.dnskey-malformed contains a lot of RRSIGs with the same
- # invalid signature using a malformed key, and one valid RRSIG
- multiple_rrset = zoneobj.get_rdataset("multiple-rrsigs", "RRSIG", "A")
- rr = multiple_rrset.pop()
- for i in range(99):
- multiple_rrset.add(create_malformed_rr(rr, i))
- multiple_rrset.add(rr)
+ # force use of the malformed ZSKs for invalid-rrsig.dnskey-malformed;
+ # the record only has one invalid RRSIG signed with a malformed ZSK
+ invalid_rrsigs = txn.get("invalid-rrsig", "RRSIG", "A")
+ txn.replace(
+ "invalid-rrsig", invalid_rrsigs.ttl, create_malformed_rr(invalid_rrsigs[0])
+ )
+
+ # multiple-rrsigs.dnskey-malformed contains a lot of RRSIGs with the same
+ # invalid signature using a malformed key, and one valid RRSIG
+ multiple_rrsigs = txn.get("multiple-rrsigs", "RRSIG", "A")
+ for i in range(99):
+ txn.add(
+ "multiple-rrsigs",
+ multiple_rrsigs.ttl,
+ create_malformed_rr(multiple_rrsigs[0], i),
+ )
zoneobj.to_file(zone.path_signed)
diff --git a/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py b/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py
index 71035dde92..a319ff7de8 100644
--- a/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py
+++ b/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py
@@ -47,11 +47,12 @@ def bootstrap():
# sign zone with valid sigs
zone.sign()
valid = dns.zone.from_file(zone.path_signed, origin="rrsigs-extra-expired.")
- rdataset = valid.find_rdataset("a", "RRSIG", "A")
# add the expired RRSIGs for a.rrsigs-extra-expired
- for rd in expired_rdata:
- rdataset.add(rd)
+ with valid.writer() as txn:
+ ttl = txn.get("a", "RRSIG", "A").ttl
+ for rd in expired_rdata:
+ txn.add("a", ttl, rd)
valid.to_file(zone.path_signed)
root = configure_root([zone])
diff --git a/bin/tests/system/nsec/tests_excessive_rrsigs.py b/bin/tests/system/nsec/tests_excessive_rrsigs.py
index b209982eab..35b8a0fa01 100644
--- a/bin/tests/system/nsec/tests_excessive_rrsigs.py
+++ b/bin/tests/system/nsec/tests_excessive_rrsigs.py
@@ -9,7 +9,6 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
-import dns.rdataclass
import dns.rdatatype
import dns.zone
@@ -43,13 +42,12 @@ def bootstrap():
f"{zone}: duplicate the RRSIG(NSEC) to exceed max-records-per-type"
)
zone = dns.zone.from_file(f"ns2/{signedfile}", origin=zone)
- for node in zone.values():
- rrsig_rdataset = node.find_rdataset(
- dns.rdataclass.IN, dns.rdatatype.RRSIG, dns.rdatatype.NSEC
- )
- orig = rrsig_rdataset[0]
- rrsig_rdataset.add(duplicate_rrsig(orig, 1))
- rrsig_rdataset.add(duplicate_rrsig(orig, 2))
+ with zone.writer() as txn:
+ for name, ttl, rrsig in zone.iterate_rdatas(
+ dns.rdatatype.RRSIG, dns.rdatatype.NSEC
+ ):
+ txn.add(name, ttl, duplicate_rrsig(rrsig, 1))
+ txn.add(name, ttl, duplicate_rrsig(rrsig, 2))
zone.to_file(f"ns2/{signedfile}", sorted=True)
return {