Commit f748b156c1 for bind
commit f748b156c13ddbbb5a3b51c9b7e72f6f81ac7186
Author: Štěpán Balážik <stepan@isc.org>
Date: Mon Oct 26 10:58:34 2026 +0100
Simplify the asserts of the nsec_synthesis tests
A record set looked up in a response is either missing or not empty, so
its truth value says whether it is there. The AA flag has a check of
its own in isctest.check.
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 99436cdaf9..ff1ae30b10 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_child_next.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_child_next.py
@@ -13,8 +13,6 @@ from pathlib import Path
import json
-import dns.flags
-
from nsec_synthesis.common import (
SIGNED_ZONE_MARKS,
check_forged_nsec,
@@ -57,7 +55,7 @@ def _prime_parent_for_aggressive_nsec():
def test_direct_insecure_child_nsec_next_fixture():
poison = isctest.query.tcp(isctest.query.create(POISON, "NSEC"), AUTH)
isctest.check.noerror(poison)
- assert poison.flags & dns.flags.AA
+ isctest.check.aaflag(poison)
check_forged_nsec(poison, poison.answer, POISON, POISON_NEXT, F023_ZONE, 12345)
@@ -73,4 +71,4 @@ def test_resolver_does_not_synth_from_insecure_child_nsec():
isctest.check.noerror(response)
assert has_a(response, TARGET, TARGET_A), response.to_text()
isctest.check.adflag(response)
- assert get_nsec(response, response.authority, POISON) is None
+ assert not get_nsec(response, response.authority, POISON)
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 01f099a376..41d8cc3ad5 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_exact_nodata.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_exact_nodata.py
@@ -69,5 +69,5 @@ def test_pending_exact_nodata_nsec_cache_poisoning():
isctest.check.noerror(response)
assert has_a(response, VICTIM, VICTIM_A), response.to_text()
isctest.check.adflag(response)
- assert get_nsec(response, response.answer, VICTIM) is None
- assert get_nsec(response, response.authority, VICTIM) is None
+ assert not get_nsec(response, response.answer, VICTIM)
+ assert not get_nsec(response, response.authority, VICTIM)
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 4c3cde1f84..f3a43ca103 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_pending_cd.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_pending_cd.py
@@ -64,7 +64,7 @@ def test_pending_trust_nsec_cd_cache_poisoning():
isctest.check.noerror(response)
assert has_a(response, VICTIM, VICTIM_A), response.to_text()
isctest.check.adflag(response)
- assert get_nsec(response, response.authority, ATTACKER) is None
+ assert not get_nsec(response, response.authority, ATTACKER)
# Step 4: Exploit Against Stub Client
response = isctest.query.tcp(
@@ -73,7 +73,7 @@ def test_pending_trust_nsec_cd_cache_poisoning():
isctest.check.noerror(response)
assert has_a(response, VICTIM, VICTIM_A), response.to_text()
isctest.check.adflag(response)
- assert get_nsec(response, response.authority, ATTACKER) is None
+ assert not get_nsec(response, response.authority, ATTACKER)
# Step 5: Verify Upstream Queries
with open("ans1/ans.run", "r", encoding="utf-8") as file:
diff --git a/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py b/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
index 5651a599c6..4898bfd9cb 100644
--- a/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
+++ b/bin/tests/system/nsec_synthesis/tests_nsec_selfloop.py
@@ -11,7 +11,6 @@
from pathlib import Path
-import dns.flags
import pytest
from isctest.run import EnvCmd
@@ -89,7 +88,7 @@ victim A {VICTIM_A}
def test_direct_child_self_loop_nsec_fixture():
response = isctest.query.tcp(isctest.query.create(PROBE, "A"), AUTH)
isctest.check.nxdomain(response)
- assert response.flags & dns.flags.AA
+ isctest.check.aaflag(response)
check_nsec(response, response.authority, CHILD, CHILD, CHILD)
@@ -103,4 +102,4 @@ def test_resolver_does_not_synth_parent_nxdomain_from_child_nsec():
isctest.check.noerror(response)
assert has_a(response, VICTIM, VICTIM_A), response.to_text()
isctest.check.adflag(response)
- assert get_nsec(response, response.authority, CHILD) is None
+ assert not get_nsec(response, response.authority, CHILD)