aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-08-13 14:22:29 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-08-13 14:22:49 -0700
commitefb835c9c0aea9d2a6487a6fdd31d459f1771879 (patch)
tree8a958c9e9dbb9de474e72c84f3203dc749bb0373
parentc6af3bad67b1b4ad9c3116edf0519665560a5ff7 (diff)
downloadrails-efb835c9c0aea9d2a6487a6fdd31d459f1771879.tar.gz
rails-efb835c9c0aea9d2a6487a6fdd31d459f1771879.tar.bz2
rails-efb835c9c0aea9d2a6487a6fdd31d459f1771879.zip
UnexpectedErrors may reference exceptions that can't be dumped
UnexpectedError exceptions wrap the original exception, and the original exception may contain a reference to something that can't be marshal dumped which will cause the process to die.
-rw-r--r--actionpack/test/abstract_unit.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 4e17d57dad..674fb253f4 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -484,6 +484,9 @@ class ForkingExecutor
method = job[1]
reporter = job[2]
result = Minitest.run_one_method klass, method
+ if result.error?
+ translate_exceptions result
+ end
queue.record reporter, result
end
}
@@ -491,6 +494,20 @@ class ForkingExecutor
@size.times { @queue << nil }
pool.each { |pid| Process.waitpid pid }
end
+
+ private
+ def translate_exceptions(result)
+ result.failures.map! { |e|
+ begin
+ Marshal.dump e
+ e
+ rescue TypeError
+ ex = Exception.new e.message
+ ex.set_backtrace e.backtrace
+ Minitest::UnexpectedError.new ex
+ end
+ }
+ end
end
if ActiveSupport::Testing::Isolation.forking_env? && PROCESS_COUNT > 0