Skip to content

Commit

Permalink
Ensure we always cleanup the databases
Browse files Browse the repository at this point in the history
This commit moves the `run_cleanup` hook into an `ensure` block so we
make sure to cleanup the databases even if an exception is raised while
running the parallel tests.
  • Loading branch information
eileencodes committed Sep 5, 2018
1 parent 3587014 commit 38f074f
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions activesupport/lib/active_support/testing/parallelization.rb
Expand Up @@ -65,22 +65,24 @@ def run_cleanup(worker)
def start
@pool = @queue_size.times.map do |worker|
fork do
DRb.stop_service
begin
DRb.stop_service

after_fork(worker)
after_fork(worker)

queue = DRbObject.new_with_uri(@url)
queue = DRbObject.new_with_uri(@url)

while job = queue.pop
klass = job[0]
method = job[1]
reporter = job[2]
result = Minitest.run_one_method(klass, method)
while job = queue.pop
klass = job[0]
method = job[1]
reporter = job[2]
result = Minitest.run_one_method(klass, method)

queue.record(reporter, result)
queue.record(reporter, result)
end
ensure
run_cleanup(worker)
end

run_cleanup(worker)
end
end
end
Expand Down

0 comments on commit 38f074f

Please sign in to comment.