Skip to content

Remove flaky sleeps from PipelineOperatorAppTest#226

Merged
jogrogan merged 1 commit into
mainfrom
jogrogan/fix-stop-suppresses-flake
May 19, 2026
Merged

Remove flaky sleeps from PipelineOperatorAppTest#226
jogrogan merged 1 commit into
mainfrom
jogrogan/fix-stop-suppresses-flake

Conversation

@jogrogan
Copy link
Copy Markdown
Collaborator

stopSuppressesFailureHandler had a race: the controller-release thread and stop() ran concurrently, so the controller's run() could return before stopRequested was set, firing the failure handler from the wrapper's finally block. Tie the release to the fake manager's shutdown() instead — stop() now deterministically sets stopRequested before releasing the controller.

Also drop two unnecessary Thread.sleep(50)s:

  • stopShutsDownControllerManagerAndUnblocksAwaitTermination: replaced the post-start sleep with a Thread.State poll so we only assert awaitTermination is blocking once the waiter thread is actually in a waiting state.
  • multipleControllerExitsFireHandlerOnlyOnce: removed entirely. awaitTermination() already waits for every wrapped controller's finally block (including reportFailure) to complete.

stopSuppressesFailureHandler had a race: the controller-release thread
and stop() ran concurrently, so the controller's run() could return
before stopRequested was set, firing the failure handler from the
wrapper's finally block. Tie the release to the fake manager's
shutdown() instead — stop() now deterministically sets stopRequested
before releasing the controller.

Also drop two unnecessary Thread.sleep(50)s:
- stopShutsDownControllerManagerAndUnblocksAwaitTermination: replaced
  the post-start sleep with a Thread.State poll so we only assert
  awaitTermination is blocking once the waiter thread is actually in
  a waiting state.
- multipleControllerExitsFireHandlerOnlyOnce: removed entirely.
  awaitTermination() already waits for every wrapped controller's
  finally block (including reportFailure) to complete.
@github-actions
Copy link
Copy Markdown

Code Coverage

Overall Project 84.24% 🟢

There is no coverage information present for the Files changed

@jogrogan jogrogan enabled auto-merge (squash) May 19, 2026 19:13
@jogrogan jogrogan merged commit 197f33a into main May 19, 2026
1 check passed
@jogrogan jogrogan deleted the jogrogan/fix-stop-suppresses-flake branch May 19, 2026 19:20
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.

2 participants