Skip to content

Make drain plugin drain spec deterministic - #5457

Open
philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:fix-drain-plugin-spec-race
Open

philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:fix-drain-plugin-spec-race

Conversation

@philippthun

@philippthun philippthun commented Sep 17, 2026

Copy link
Copy Markdown
Member

The 'works off all remaining jobs before exiting' example raced the worker loop against TERM signal delivery. On slow/contended runners the drain flag (exit_on_complete) flipped late, so work_off ran extra times and the count inflated past 3.

Block the worker after its first work_off call until the test confirms the drain TERM handler has set exit_on_complete, then release it. This removes the timing dependency and makes the call count deterministic.

This change was developed with AI assistance; all code was reviewed and tested by me.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

The 'works off all remaining jobs before exiting' example raced the
worker loop against TERM signal delivery. On slow/contended runners the
drain flag (exit_on_complete) flipped late, so work_off ran extra times
and the count inflated past 3.

Block the worker after its first work_off call until the test confirms
the drain TERM handler has set exit_on_complete, then release it. This
removes the timing dependency and makes the call count deterministic.
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.

1 participant