Skip to content

Fail parallel tests if workers exit early #36369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2019

Conversation

jhawthorn
Copy link
Member

Previously, if a test worker exited early, the in-flight test it was supposed to run wasn't reported as a failure.

If all workers exited immediately, this would previously be reported as (for example)

Finished in 1.708349s, 39.2192 runs/s, 79.0237 assertions/s.
67 runs, 135 assertions, 0 failures, 0 errors, 2 skips

This commit validates that all workers finish running their tests by ensuring that the queue is empty after they exit. This works because we signal the workers to exit by pushing one nil each onto the queue, so the number of items left in the queue should matching the number of missed tests (technically off by one if the worker runs no tests, but 🤷‍♂).

Previously, if a test worker exited early, the in-flight test it was
supposed to run wasn't reported as a failure.

If all workers exited immediately, this would be reported as ex.

    Finished in 1.708349s, 39.2192 runs/s, 79.0237 assertions/s.
    67 runs, 135 assertions, 0 failures, 0 errors, 2 skips

This commit validates that all workers finish running tests by ensuring
that the queue is empty after they exit. This works because we signal
the workers to exit by pushing nil onto the queue, so that there should
be a number of items left in the queue matching potentially missed
tests.
@eileencodes eileencodes added this to the 6.0.0 milestone May 31, 2019
@jhawthorn jhawthorn merged commit 06ae49d into rails:master May 31, 2019
jhawthorn added a commit that referenced this pull request May 31, 2019
Fail parallel tests if workers exit early
@jhawthorn jhawthorn deleted the parallel_worker_crash branch May 31, 2019 17:19
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.

2 participants