Skip to content

Commit 6219fec

Browse files
committed
Coerce test to managable number of records
1 parent a07552c commit 6219fec

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/cases/coerced_tests.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,3 +1395,22 @@ class EnumTest < ActiveRecord::TestCase
13951395
Book.connection.add_index(:books, [:author_id, :name], unique: true)
13961396
end
13971397
end
1398+
1399+
1400+
1401+
1402+
require 'models/citation'
1403+
class EagerLoadingTooManyIdsTest < ActiveRecord::TestCase
1404+
# Original Rails test fails with SQL Server error message "The query processor ran out of internal resources and
1405+
# could not produce a query plan". This error goes away if you change database compatibility level to 110 (SQL 2012).
1406+
# However, you cannot change the compatibility level during a test. The purpose of the test is to ensure that the
1407+
# bind params are not used if they exceed the `bind_params_length` of the adapter. The coerced test still does
1408+
# this as there will be 32,768 remaining citation records in teh database and the `bind_params_length` of
1409+
# adapter is 2,098.
1410+
coerce_tests! :test_eager_loading_too_may_ids
1411+
def test_eager_loading_too_may_ids_coerced
1412+
Citation.limit(32768).order(id: :desc).delete_all
1413+
1414+
original_test_eager_loading_too_may_ids
1415+
end
1416+
end

0 commit comments

Comments
 (0)