fix: Ensure parallel rules aren't bypassed on retries #2404
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤔 What's changed?
When a cucumber worker sends the
testCaseFinished
event back to the coordinator, do not mark the worker as "not in progress" until after all retries have finished being processed by the worker.⚡️ What's your motivation?
Howdy, I started getting feedback from other people that Cucumber wasn't respecting parallel rules when retrying long-running tests in certain situations. I was skeptical at first, but I was able to replicate it and find the source of the problem.
The following test minimally reproduces the issue:
For this example, I had retries set to 4 to really hammer the point home. I started realizing that the
NO PARALLEL
tests actually started running, even when theSHOULD FAIL
test was still doing a retry. This only occurs if the subsequent parallel scenarios finish and non-parallel tests need to run. Because thethis.inProgressWorkers
map is empty, it forces thenotInParallel
test to run while the retries are being attempted. This is causing flakiness in some of our tests.You can remove the changes from
src/runtime/parallel/coordinator.ts
and the test case provided in the PR will fail, demonstrating the issue and ensuring the issue is not encountered again.🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
The scenario and step definition look kinda ugly, so I'm very much open to ideas to make the code look a bit simpler. Filtering through the envelopes is always a bit difficult to do cleanly, especially without chaining higher order functions.
📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.