Skip to content

test: fix race in test_get_info_partial - #1826

Merged
bdraco merged 1 commit into
masterfrom
fix-flaky-get-info-partial
Aug 28, 2026
Merged

bdraco merged 1 commit into
masterfrom
fix-flaky-get-info-partial

Conversation

@bdraco

@bdraco bdraco commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

test_get_info_partial cleared send_event before _inject_response, so a query generated from the pre inject cache could satisfy the wait; on a slow runner the second wait then saw a stale query that still asked for TXT and failed with assert 4 == 3, seen on the pypy use_cython job.

Details

  • _inject_response blocks until the response is processed on the loop, so clearing send_event after it returns guarantees the next captured query was built from the updated cache; any stale send has already set the event and gets discarded by the clear
  • wait_time is now 2s and the helper timeout 10s, covering the ~1s duplicate question interval when a stale query burns a slot
  • the final stage waits on service_info_event instead of timing out on send_event, so the completion assert does not depend on thread scheduling

Test plan

  • reproduced the CI failure by delaying _inject_responses by 50ms, the old test fails with assert 4 == 3, the fixed test passes
  • 50 consecutive local runs pass; full tests/services/test_info.py passes with the cython build

@codspeed

codspeed Bot commented Aug 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing fix-flaky-get-info-partial (5e49bb8) with master (3917459)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (b37155e) during the generation of this report, so 3917459 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@bdraco
bdraco marked this pull request as ready for review August 28, 2026 18:13
@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.81%. Comparing base (ea490c0) to head (5e49bb8).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1826   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          33       33           
  Lines        3772     3799   +27     
  Branches      536      543    +7     
=======================================
+ Hits         3765     3792   +27     
  Misses          5        5           
  Partials        2        2           

☔ View full report in Codecov by Harness.
📢 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.

@bdraco
bdraco merged commit 7635d45 into master Aug 28, 2026
34 checks passed
@bdraco
bdraco deleted the fix-flaky-get-info-partial branch August 28, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant