diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-07-16 23:16:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-16 23:16:23 +0100 |
commit | 1b984fc258656f741b02565e7c50b4bb45f7de52 (patch) | |
tree | 61b1eeb7dececd7301e2cba5d9eaacc102c18375 /activerecord/test/cases/adapters | |
parent | d473561071082489fa3f6ce11b42c9beea9b0ddc (diff) | |
parent | 730d810b0dd24e80c1e88d56a5e6960363a25dbb (diff) | |
download | rails-1b984fc258656f741b02565e7c50b4bb45f7de52.tar.gz rails-1b984fc258656f741b02565e7c50b4bb45f7de52.tar.bz2 rails-1b984fc258656f741b02565e7c50b4bb45f7de52.zip |
Merge pull request #36694 from kirs/timeout-error-superclass
[ActiveRecord] Superclass for aborted queries
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/transaction_test.rb | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb index 6387f65b62..cfc1823773 100644 --- a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb +++ b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb @@ -233,6 +233,7 @@ class Mysql2AdapterTest < ActiveRecord::Mysql2TestCase error = assert_raises(ActiveRecord::AdapterTimeout) do ActiveRecord::Base.connection.execute("SELECT SLEEP(2)") end + assert_kind_of ActiveRecord::QueryAborted, error assert_equal Mysql2::Error::TimeoutError, error.cause.class ensure diff --git a/activerecord/test/cases/adapters/mysql2/transaction_test.rb b/activerecord/test/cases/adapters/mysql2/transaction_test.rb index 52e283f247..2041cc308f 100644 --- a/activerecord/test/cases/adapters/mysql2/transaction_test.rb +++ b/activerecord/test/cases/adapters/mysql2/transaction_test.rb @@ -92,7 +92,7 @@ module ActiveRecord test "raises StatementTimeout when statement timeout exceeded" do skip unless ActiveRecord::Base.connection.show_variable("max_execution_time") - assert_raises(ActiveRecord::StatementTimeout) do + error = assert_raises(ActiveRecord::StatementTimeout) do s = Sample.create!(value: 1) latch1 = Concurrent::CountDownLatch.new latch2 = Concurrent::CountDownLatch.new @@ -117,10 +117,11 @@ module ActiveRecord thread.join end end + assert_kind_of ActiveRecord::QueryAborted, error end test "raises QueryCanceled when canceling statement due to user request" do - assert_raises(ActiveRecord::QueryCanceled) do + error = assert_raises(ActiveRecord::QueryCanceled) do s = Sample.create!(value: 1) latch = Concurrent::CountDownLatch.new @@ -144,6 +145,7 @@ module ActiveRecord thread.join end end + assert_kind_of ActiveRecord::QueryAborted, error end end end |