1
1
# frozen_string_literal: true
2
2
3
3
require "cases/helper"
4
- require "support/connection_helper"
5
4
require "models/post"
6
5
7
6
module AsynchronousQueriesSharedTests
@@ -127,6 +126,10 @@ def setup
127
126
end
128
127
129
128
class AsynchronousExecutorTypeTest < ActiveRecord ::TestCase
129
+ def teardown
130
+ clean_up_connection_handler
131
+ end
132
+
130
133
def test_null_configuration_uses_a_single_null_executor_by_default
131
134
old_value = ActiveRecord . async_query_executor
132
135
ActiveRecord . async_query_executor = nil
@@ -145,7 +148,6 @@ def test_null_configuration_uses_a_single_null_executor_by_default
145
148
146
149
assert_equal 2 , handler . connection_pool_list ( :all ) . count
147
150
ensure
148
- clean_up_connection_handler
149
151
ActiveRecord . async_query_executor = old_value
150
152
end
151
153
@@ -178,7 +180,6 @@ def test_one_global_thread_pool_is_used_when_set_with_default_concurrency
178
180
assert_equal 2 , handler . connection_pool_list ( :all ) . count
179
181
assert_equal async_pool1 , async_pool2
180
182
ensure
181
- clean_up_connection_handler
182
183
ActiveRecord . async_query_executor = old_value
183
184
end
184
185
@@ -215,7 +216,6 @@ def test_concurrency_can_be_set_on_global_thread_pool
215
216
assert_equal 2 , handler . connection_pool_list ( :all ) . count
216
217
assert_equal async_pool1 , async_pool2
217
218
ensure
218
- clean_up_connection_handler
219
219
ActiveRecord . global_executor_concurrency = old_concurrency
220
220
ActiveRecord . async_query_executor = old_value
221
221
ActiveRecord . instance_variable_set ( :@global_thread_pool_async_query_executor , old_global_thread_pool_async_query_executor )
@@ -269,7 +269,6 @@ def test_multi_thread_pool_executor_configuration
269
269
assert_equal 2 , handler . connection_pool_list ( :all ) . count
270
270
assert_not_equal async_pool1 , async_pool2
271
271
ensure
272
- clean_up_connection_handler
273
272
ActiveRecord . async_query_executor = old_value
274
273
end
275
274
@@ -304,7 +303,6 @@ def test_multi_thread_pool_is_used_only_by_configurations_that_enable_it
304
303
assert_equal 2 , handler . connection_pool_list ( :all ) . count
305
304
assert_not_equal async_pool1 , async_pool2
306
305
ensure
307
- clean_up_connection_handler
308
306
ActiveRecord . async_query_executor = old_value
309
307
end
310
308
end
0 commit comments