]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Report expected and last returned rcode on query timeout
authorMichal Nowak <mnowak@isc.org>
Fri, 27 Sep 2024 11:38:00 +0000 (13:38 +0200)
committerMichal Nowak <mnowak@isc.org>
Tue, 1 Oct 2024 11:25:56 +0000 (13:25 +0200)
Sometimes it's useful to see what was the server returning that did not
match the expected rcode.

bin/tests/system/isctest/query.py

index 2fc1cccdfe1a4af9ab0ad2f72af34de1bc9228f9..5662d1e3807b9d3286cb988875db64ed73a7fddc 100644 (file)
@@ -48,6 +48,11 @@ def generic_query(
         except (dns.exception.Timeout, ConnectionRefusedError) as e:
             isctest.log.debug(f"{query_func.__name__}(): the '{e}' exceptio raised")
         time.sleep(1)
+    if expected_rcode is not None:
+        last_rcode = dns_rcode.to_text(res.rcode()) if res else None
+        isctest.log.debug(
+            f"{query_func.__name__}(): expected rcode={dns_rcode.to_text(expected_rcode)}, last rcode={last_rcode}"
+        )
     raise dns.exception.Timeout