From ae5b50f37f4c510bb9f2a949dfd124e3f23ec7ac Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Mon, 2 Feb 2026 10:33:15 -0800 Subject: [PATCH] test(core): increase `delta_time` for flaky test (#34982) This regularly flaked --- .../unit_tests/tracers/test_memory_stream.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libs/core/tests/unit_tests/tracers/test_memory_stream.py b/libs/core/tests/unit_tests/tracers/test_memory_stream.py index da96e6d7bb3..ba9daa913cd 100644 --- a/libs/core/tests/unit_tests/tracers/test_memory_stream.py +++ b/libs/core/tests/unit_tests/tracers/test_memory_stream.py @@ -102,15 +102,12 @@ async def test_queue_for_streaming_via_sync_call() -> None: for item in items: delta_time = item["receive_time"] - item["produce_time"] - # Allow a generous 10ms of delay - # The test is meant to verify that the producer and consumer are running in - # parallel despite the fact that the producer is running from another thread. - # abs_tol is used to allow for some delay in the producer and consumer - # due to overhead. - # To verify that the producer and consumer are running in parallel, we - # expect the delta_time to be smaller than the sleep delay in the producer - # * # of items = 30 ms - assert math.isclose(delta_time, 0, abs_tol=0.020) is True, ( + # The test verifies that the producer and consumer are running in parallel + # despite the producer running from another thread via asyncio.to_thread. + # Cross-thread communication has overhead that varies with system load, + # so we use a tolerance of 150ms. This still proves parallelism because + # serial execution would show deltas of 200ms+ (the sleep interval). + assert math.isclose(delta_time, 0, abs_tol=0.15) is True, ( f"delta_time: {delta_time}" )