From a5ed242a508fe0bf593a97f2867a959142b9a534 Mon Sep 17 00:00:00 2001 From: sdk-sentinel-bot Date: Sat, 17 Oct 2026 01:03:25 +0000 Subject: [PATCH] Synchronize alternate ordering test with history --- tests/worker/test_workflow.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index cfc0190314..c918636146 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -8468,22 +8468,25 @@ async def test_alternate_async_loop_ordering(client: Client, env: WorkflowEnviro task_queue=task_queue, ) + async def wait_for_history_event(event_type: EventType.ValueType) -> None: + async for event in handle.fetch_history_events(wait_new_event=True): + if event.event_type is event_type: + return + async with new_worker( client, ActivityAndSignalsWhileWorkflowDown, activities=[say_hello], task_queue=task_queue, ): - # This sleep exists to make sure the first WFT is processed - await asyncio.sleep(0.2) + await wait_for_history_event(EventType.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED) async with new_worker( client, activities=[say_hello], task_queue=activity_tq, ): - # Make sure the activity starts being processed before sending signals - await asyncio.sleep(1) + await wait_for_history_event(EventType.EVENT_TYPE_ACTIVITY_TASK_COMPLETED) await handle.signal(ActivityAndSignalsWhileWorkflowDown.dosig, "1") await handle.signal(ActivityAndSignalsWhileWorkflowDown.dosig, "2")