Skip to content

test: Fix flaky test_emit_system_info_event by waiting on event#1887

Merged
vdusek merged 1 commit intomasterfrom
fix/flaky-system-info-event-test
May 9, 2026
Merged

test: Fix flaky test_emit_system_info_event by waiting on event#1887
vdusek merged 1 commit intomasterfrom
fix/flaky-system-info-event-test

Conversation

@vdusek
Copy link
Copy Markdown
Collaborator

@vdusek vdusek commented May 9, 2026

Summary

The test_emit_system_info_event test was flaking on macOS CI (e.g. run 25595850020). It registered a listener and slept for 50ms × 10 = 500ms hoping at least one SYSTEM_INFO event would fire. Under heavy parallel xdist load, psutil.cpu_percent(interval=0.1) running inside asyncio.to_thread could be delayed enough that no event reached the listener within the 500ms window.

This replaces the fixed sleep with an asyncio.Event that the listener sets, awaited via asyncio.wait_for(..., timeout=10). The test now returns as soon as the first event is observed and only waits up to 10s as a safety net — same pattern as #1830 for the sibling tests in test_event_manager.py.

Replace the fixed `asyncio.sleep` with an `asyncio.Event` set from the
listener and awaited with a generous timeout. Under loaded CI runners,
`psutil.cpu_percent(interval=0.1)` running in `asyncio.to_thread` could
delay the first emission past the 500ms window, leaving the listener
uncalled.
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels May 9, 2026
@vdusek vdusek self-assigned this May 9, 2026
@github-actions github-actions Bot added this to the 140th sprint - Tooling team milestone May 9, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label May 9, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.72%. Comparing base (a60c17b) to head (2ddda38).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1887      +/-   ##
==========================================
- Coverage   92.78%   92.72%   -0.07%     
==========================================
  Files         161      161              
  Lines       11356    11356              
==========================================
- Hits        10537    10530       -7     
- Misses        819      826       +7     
Flag Coverage Δ
unit 92.72% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek merged commit 590ad1c into master May 9, 2026
32 checks passed
@vdusek vdusek deleted the fix/flaky-system-info-event-test branch May 9, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants