aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing/parallelization.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-05-31 09:05:47 -0700
committerGitHub <noreply@github.com>2019-05-31 09:05:47 -0700
commit06ae49d99c4bc6263a913529ca969d5505fcfdbe (patch)
tree1954202751bdbb7ba27086eac619d78009683ffb /activesupport/lib/active_support/testing/parallelization.rb
parent5ce1f66d7ac50492f4cd1e6bd0170b2c888ec73d (diff)
parent9fd02d181a0706cd3a98e08b2caa7c9ed3c39b50 (diff)
downloadrails-06ae49d99c4bc6263a913529ca969d5505fcfdbe.tar.gz
rails-06ae49d99c4bc6263a913529ca969d5505fcfdbe.tar.bz2
rails-06ae49d99c4bc6263a913529ca969d5505fcfdbe.zip
Merge pull request #36369 from jhawthorn/parallel_worker_crash
Fail parallel tests if workers exit early
Diffstat (limited to 'activesupport/lib/active_support/testing/parallelization.rb')
-rw-r--r--activesupport/lib/active_support/testing/parallelization.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/testing/parallelization.rb b/activesupport/lib/active_support/testing/parallelization.rb
index e760bf5ce3..f50a5e0554 100644
--- a/activesupport/lib/active_support/testing/parallelization.rb
+++ b/activesupport/lib/active_support/testing/parallelization.rb
@@ -27,6 +27,10 @@ module ActiveSupport
@queue << o
end
+ def length
+ @queue.length
+ end
+
def pop; @queue.pop; end
end
@@ -109,6 +113,10 @@ module ActiveSupport
def shutdown
@queue_size.times { @queue << nil }
@pool.each { |pid| Process.waitpid pid }
+
+ if @queue.length > 0
+ raise "Queue not empty, but all workers have finished. This probably means that a worker crashed and #{@queue.length} tests were missed."
+ end
end
private