1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-09 10:22:41 +03:00
parent 23ce5de31e
commit 2a3c05020f

View file

@ -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"), [])