Skip to content

Commit

Permalink
Suppress expected exceptions by report_on_exception = false
Browse files Browse the repository at this point in the history
Follow up #31428 to address similar exceptions with mysql2 adapter
  • Loading branch information
yahonda committed Dec 14, 2017
1 parent 659c516 commit 521c946
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions activerecord/test/cases/adapters/mysql2/transaction_test.rb
Expand Up @@ -13,6 +13,7 @@ class Sample < ActiveRecord::Base

setup do
@abort, Thread.abort_on_exception = Thread.abort_on_exception, false
Thread.report_on_exception, @original_report_on_exception = false, Thread.report_on_exception if Thread.respond_to?(:report_on_exception)

@connection = ActiveRecord::Base.connection
@connection.clear_cache!
Expand All @@ -31,6 +32,7 @@ class Sample < ActiveRecord::Base
@connection.drop_table "samples", if_exists: true

Thread.abort_on_exception = @abort
Thread.report_on_exception = @original_report_on_exception if Thread.respond_to?(:report_on_exception)
end

test "raises Deadlocked when a deadlock is encountered" do
Expand Down

0 comments on commit 521c946

Please sign in to comment.