The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): wait for the drain watcher with async_wait_until
unsupportedpastels765c6463009f
diff --git a/tests/gateway/test_startup_failed_platform_reports_degraded.py b/tests/gateway/test_startup_failed_platform_reports_degraded.pyindex c1cbdd23421..5941628dbd2 100644--- a/tests/gateway/test_startup_failed_platform_reports_degraded.py+++ b/tests/gateway/test_startup_failed_platform_reports_degraded.py@@ -7,7 +7,6 @@ status looked healthy, every API client was gone, nothing retried. The startup sgate — every platform, not just api_server — so the same failure on any other platform is reportedthe same way."""-import asyncioimport loggingimport timefrom unittest.mock import AsyncMock@@ -18,6 +17,7 @@ from gateway.config import GatewayConfig, Platform, PlatformConfigfrom gateway.platforms.base import BasePlatformAdapterfrom gateway.run import GatewayRunnerfrom gateway.status import flush_runtime_status_async, read_runtime_status+from tests.waiting import async_wait_untilclass _PortTakenAdapter(BasePlatformAdapter):@@ -207,11 +207,10 @@ async def test_last_platform_parked_during_an_external_drain_keeps_draining_untiassert await runner.start() is Trueasync def _drain_watcher_settles(active):- for _ in range(50): # the watcher polls the marker every second- if runner._external_drain_active is active:- return- await asyncio.sleep(0.1)- raise AssertionError(f"external drain never became {active}")+ # the watcher polls the marker every second+ await async_wait_until(+ lambda: runner._external_drain_active is active, what=f"external drain to become {active}"+ )try:await _drain_watcher_settles(True)