From 2a3c05020fa2101712e694419a7fdfeab2aade3f Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 9 Nov 2026 10:22:41 +0300 Subject: [PATCH] test(connection): host-request tests give the fake open 1 s, not 0.2 s CONNECT_TIMEOUT bounds both the wait for a host's request slot, which these tests time out on purpose, and the wait for the open's thread, which they expect to finish. 0.2 s was missed once on a CI runner ("h did not answer within 0.2 s" in test_an_ended_request_lets_the_next_one_in). The four refusal tests now wait 1 s each. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea --- vrtManager/tests/test_connection.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vrtManager/tests/test_connection.py b/vrtManager/tests/test_connection.py index 76163b63..077b1392 100644 --- a/vrtManager/tests/test_connection.py +++ b/vrtManager/tests/test_connection.py @@ -220,8 +220,12 @@ class HostRequestsTestCase(unittest.TestCase): """At most HOST_REQUESTS web requests of a process use one host at a time; another waits CONNECT_TIMEOUT and is refused.""" + # also how long a request waits for the fake open's thread: 0.2 s was + # missed on a loaded CI runner ("h did not answer within 0.2 s") + TIMEOUT = 1.0 + def setUp(self): - for name, value in (("wvmEventLoop", MagicMock()), ("CONNECT_TIMEOUT", 0.2)): + for name, value in (("wvmEventLoop", MagicMock()), ("CONNECT_TIMEOUT", self.TIMEOUT)): patcher = patch(f"vrtManager.connection.{name}", value) patcher.start() self.addCleanup(patcher.stop) @@ -266,7 +270,7 @@ class HostRequestsTestCase(unittest.TestCase): started = time.monotonic() with self.assertLogs("vrtManager.connection", "WARNING") as logs: self.assertEqual(self.request("h"), ["Connection Failed: h does not answer: 2 requests still wait for it"]) - self.assertGreaterEqual(time.monotonic() - started, 0.2) + self.assertGreaterEqual(time.monotonic() - started, self.TIMEOUT) self.assertEqual(logs.output, ["WARNING:vrtManager.connection:h: request refused, 2 requests still wait for the host"]) self.assertEqual(self.request("g"), [])