2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Replace dnspython resolver.query() with resolver.resolve()

The resolver.query() has been deprecated in favor of resolver.resolve();
used that.
This commit is contained in:
Ondřej Surý
2023-03-22 15:11:59 +01:00
parent ba1c9f1fd1
commit 3b1756d450
3 changed files with 4 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ def test_dnstap_dispatch_socket_addresses(named_port):
resolver.port = named_port
# Send some query to ns3 so that it records something in its dnstap file.
ans = resolver.query("mail.example.", "A")
ans = resolver.resolve("mail.example.", "A")
assert ans[0].address == "10.0.0.2"
# Before continuing, roll dnstap file to ensure it is flushed to disk.

View File

@@ -25,14 +25,14 @@ def test_rpz_passthru_logging(named_port):
resolver.port = named_port
# Should generate a log entry into rpz_passthru.txt
ans = resolver.query("allowed.", "A")
ans = resolver.resolve("allowed.", "A", source="10.53.0.1")
for rd in ans:
assert rd.address == "10.53.0.2"
# baddomain.com isn't allowed (CNAME .), should return NXDOMAIN
# Should generate a log entry into rpz.txt
with pytest.raises(dns.resolver.NXDOMAIN):
resolver.query("baddomain.", "A")
resolver.resolve("baddomain.", "A", source="10.53.0.1")
rpz_passthru_logfile = os.path.join("ns1", "rpz_passthru.txt")
rpz_logfile = os.path.join("ns1", "rpz.txt")

View File

@@ -169,7 +169,7 @@ def test_named_shutdown(named_port, control_port):
# wait for named to finish loading
for _ in range(10):
try:
resolver.query("version.bind", "TXT", "CH")
resolver.resolve("version.bind", "TXT", "CH")
break
except (dns.resolver.NoNameservers, dns.exception.Timeout):
time.sleep(1)