Skip to content

The agent that grows with you

test(photon): drain detached fatal-notification task in zombie watchdog test

Teknium59400262455b
diff --git a/tests/plugins/platforms/photon/test_zombie_stream_watchdog.py b/tests/plugins/platforms/photon/test_zombie_stream_watchdog.py
index e3f9dd6749f..b8b9689f8bf 100644
--- a/tests/plugins/platforms/photon/test_zombie_stream_watchdog.py
+++ b/tests/plugins/platforms/photon/test_zombie_stream_watchdog.py
@@ -23,6 +23,7 @@ gRPC traffic occurs.
"""
from __future__ import annotations
+import asyncio
import json
import subprocess
from pathlib import Path
@@ -240,6 +241,13 @@ async def test_monitor_still_raises_fatal_when_zombie_degrades_stream(
await adapter._monitor_sidecar_health()
+ # Fatal notification is dispatched from a detached task (so callers can't
+ # cancel their own handoff) — drain pending tasks before asserting.
+ for _ in range(50):
+ if notified:
+ break
+ await asyncio.sleep(0)
+
assert adapter.has_fatal_error is True
assert adapter.fatal_error_code == "UPSTREAM_STREAM_DEGRADED"
assert adapter.fatal_error_retryable is True