aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAric Walker <aricwalker@github.com>2019-04-14 16:03:06 -0600
committerAric Walker <aricwalker@github.com>2019-04-18 12:23:24 -0600
commite460c77d380db3c2c3ab3a648214b81dae649b7a (patch)
treeeaf5d10c5af044f4ed3e2e0bc2cd187f59a3e30a /activesupport
parent0f39a7488ed736a76cc6cee166fba01d1e3c5686 (diff)
downloadrails-e460c77d380db3c2c3ab3a648214b81dae649b7a.tar.gz
rails-e460c77d380db3c2c3ab3a648214b81dae649b7a.tar.bz2
rails-e460c77d380db3c2c3ab3a648214b81dae649b7a.zip
If exception occurs during setup, add to each test executed
Resolves https://github.com/rails/rails/issues/35835 If an exception occurs during `parallelize_setup` make sure to catch that exception and apply it to the result of each successive test run. This results in marking all of the tests as failed to bring attention to the issue & ensure it is addressed before proceeding.
Diffstat (limited to 'activesupport')
-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