Skip to content

Fix DispatchStreamProcessorTest.raceToStream flakiness - #8275

Merged
akarnokd merged 3 commits into
4.xfrom
copilot/fix-dispatchstreamprocessortest-failure
Aug 6, 2026
Merged

Fix DispatchStreamProcessorTest.raceToStream flakiness#8275
akarnokd merged 3 commits into
4.xfrom
copilot/fix-dispatchstreamprocessortest-failure

Conversation

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

raceToStream failed intermittently with dsp has streamers? expected false was true after cancel. Async subscribe/cancel could leave streamers attached past the wait, and the await helpers used unreliable loop-based timeouts.

DispatchStreamProcessor.stream()

  • Add the streamer to the array first, then register with cancellation (PublishProcessor pattern)
  • If dispose raced the add, remove again so a disposed streamer cannot stick in the array

Test helpers (StreamableBaseTest)

  • Drive waits off wall-clock System.nanoTime() / TimeUnit instead of loop counters (avoids excess delay and early timeout)
  • Add assertNoStreamers / assertHasStreamers (with optional count)

DispatchStreamProcessorTest

  • Wait for both subscribers before cancel in raceToStream:
assertHasStreamers(dsp, 1000, 2);
ts.cancel();
ts2.cancel();
assertNoStreamers(dsp, 1000);
  • Replace bare assertFalse(hasStreamers()) / await* pairs with the assert helpers elsewhere in the class

Copilot AI linked an issue Aug 6, 2026 that may be closed by this pull request
@akarnokd akarnokd added this to the 4.0 milestone Aug 6, 2026
Copilot AI and others added 2 commits August 6, 2026 05:30
Co-authored-by: akarnokd <1269832+akarnokd@users.noreply.github.com>
Co-authored-by: akarnokd <1269832+akarnokd@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix DispatchStreamProcessorTest unit test failure Fix DispatchStreamProcessorTest.raceToStream flakiness Aug 6, 2026
Copilot AI requested a review from akarnokd August 6, 2026 05:33
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.61%. Comparing base (f6d80d2) to head (7b65a64).
⚠️ Report is 2 commits behind head on 4.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                4.x    #8275      +/-   ##
============================================
+ Coverage     98.58%   98.61%   +0.03%     
+ Complexity     7147     7146       -1     
============================================
  Files           824      824              
  Lines         50782    50784       +2     
  Branches       6906     6907       +1     
============================================
+ Hits          50064    50083      +19     
+ Misses          488      481       -7     
+ Partials        230      220      -10     

☔ 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.

@akarnokd
akarnokd marked this pull request as ready for review August 6, 2026 07:00
@akarnokd
akarnokd merged commit 38a3ffe into 4.x Aug 6, 2026
13 checks passed
@akarnokd
akarnokd deleted the copilot/fix-dispatchstreamprocessortest-failure branch August 6, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DispatchStreamProcessorTest unit test failure

2 participants