mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-11-14 16:07:25 +00:00
python3-dnspython: Retry socket timeouts in ptests
testQueryUDPFallbackWithSocket fails intermittently because it connects its TCP socket with a 2s socket timeout, and the resulting TimeoutError is not dns.exception.Timeout, so the test's retry_on_timeout decorator does not retry it. Retry TimeoutError too and give the connect the same 4s budget as the query. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
2 files changed
+48
No files matched your search
+47
@@ -0,0 +1,47 @@
|
||||
From 0d751963d381da8adbbe4bcb9c0163e41f70eeca Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <khem.raj@oss.qualcomm.com>
|
||||
Date: Thu, 12 Nov 2026 22:41:22 -0800
|
||||
Subject: [PATCH] tests: retry socket timeouts in retry_on_timeout
|
||||
|
||||
testQueryUDPFallbackWithSocket opens its TCP socket itself with a 2
|
||||
second socket timeout. When that connect is slow (e.g. on a loaded host
|
||||
or an emulated target) it raises the builtin TimeoutError rather than
|
||||
dns.exception.Timeout, so retry_on_timeout does not retry it and the
|
||||
test fails intermittently.
|
||||
|
||||
Retry TimeoutError as well, and give the connect the same 4 second
|
||||
budget as the query itself.
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/rthalley/dnspython/pull/1423]
|
||||
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
|
||||
---
|
||||
tests/test_query.py | 2 +-
|
||||
tests/util.py | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/test_query.py b/tests/test_query.py
|
||||
index 1c949e6..a6f1a1b 100644
|
||||
--- a/tests/test_query.py
|
||||
+++ b/tests/test_query.py
|
||||
@@ -230,7 +230,7 @@ class QueryTests(unittest.TestCase):
|
||||
udp_s.setblocking(0)
|
||||
with socket.socket(af, socket.SOCK_STREAM) as tcp_s:
|
||||
ll = dns.inet.low_level_address_tuple((address, 53))
|
||||
- tcp_s.settimeout(2)
|
||||
+ tcp_s.settimeout(4)
|
||||
tcp_s.connect(ll)
|
||||
tcp_s.setblocking(0)
|
||||
qname = dns.name.from_text(".")
|
||||
diff --git a/tests/util.py b/tests/util.py
|
||||
index a448f2d..84e16c0 100644
|
||||
--- a/tests/util.py
|
||||
+++ b/tests/util.py
|
||||
@@ -144,7 +144,7 @@ def retry_on_timeout(f):
|
||||
f(*args, **kwargs)
|
||||
bad = False
|
||||
break
|
||||
- except dns.exception.Timeout:
|
||||
+ except (dns.exception.Timeout, TimeoutError):
|
||||
pass
|
||||
if bad:
|
||||
raise dns.exception.Timeout
|
||||
@@ -12,6 +12,7 @@ inherit pypi python_hatchling ptest
|
||||
SRC_URI += " \
|
||||
file://run-ptest \
|
||||
file://0001-tests-skip-DDR-tests-when-the-resolvers-do-not-answe.patch \
|
||||
file://0001-tests-retry-socket-timeouts-in-retry_on_timeout.patch \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN}-ptest += " \
|
||||
|
||||
Reference in new issue
Block a user