diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-04-18 15:23:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-18 15:23:54 -0400 |
commit | 8ac4d1500505f15ba3630ba1e88d395ad43442a5 (patch) | |
tree | eeabe74d7ae1f495a54823d78ddf4e6ed927ef1f /activesupport/lib/active_support/testing/parallelization.rb | |
parent | 50b9c9d3484e061d58da17faefcb296fce55ec50 (diff) | |
parent | e460c77d380db3c2c3ab3a648214b81dae649b7a (diff) | |
download | rails-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
Diffstat (limited to 'activesupport/lib/active_support/testing/parallelization.rb')
-rw-r--r-- | activesupport/lib/active_support/testing/parallelization.rb | 11 |
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 |