aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-04-18 15:23:54 -0400
committerGitHub <noreply@github.com>2019-04-18 15:23:54 -0400
commit8ac4d1500505f15ba3630ba1e88d395ad43442a5 (patch)
treeeeabe74d7ae1f495a54823d78ddf4e6ed927ef1f
parent50b9c9d3484e061d58da17faefcb296fce55ec50 (diff)
parente460c77d380db3c2c3ab3a648214b81dae649b7a (diff)
downloadrails-8ac4d1500505f15ba3630ba1e88d395ad43442a5.tar.gz
rails-8ac4d1500505f15ba3630ba1e88d395ad43442a5.tar.bz2
rails-8ac4d1500505f15ba3630ba1e88d395ad43442a5.zip
Merge pull request #36018 from aricwalker/parallel-setup-exception
Catch exceptions raised in `parallelize_setup` and ensure tests fail when they occur
-rw-r--r--activesupport/lib/active_support/testing/parallelization.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/testing/parallelization.rb b/activesupport/lib/active_support/testing/parallelization.rb
index 08285b2f52..e760bf5ce3 100644
--- a/activesupport/lib/active_support/testing/parallelization.rb
+++ b/activesupport/lib/active_support/testing/parallelization.rb
@@ -71,7 +71,9 @@ module ActiveSupport
fork do
DRb.stop_service
- after_fork(worker)
+ begin
+ after_fork(worker)
+ rescue => setup_exception; end
queue = DRbObject.new_with_uri(@url)
@@ -83,6 +85,8 @@ module ActiveSupport
Minitest.run_one_method(klass, method)
end
+ add_setup_exception(result, setup_exception) if setup_exception
+
begin
queue.record(reporter, result)
rescue DRb::DRbConnError
@@ -106,6 +110,11 @@ module ActiveSupport
@queue_size.times { @queue << nil }
@pool.each { |pid| Process.waitpid pid }
end
+
+ private
+ def add_setup_exception(result, setup_exception)
+ result.failures.prepend Minitest::UnexpectedError.new(setup_exception)
+ end
end
end
end