Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /spec/support/before_all_adapter.rb
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/support/before_all_adapter.rb')
-rw-r--r--spec/support/before_all_adapter.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/support/before_all_adapter.rb b/spec/support/before_all_adapter.rb
index f48e0f46e80..890bdd6a2c4 100644
--- a/spec/support/before_all_adapter.rb
+++ b/spec/support/before_all_adapter.rb
@@ -1,25 +1,25 @@
# frozen_string_literal: true
class BeforeAllAdapter # rubocop:disable Gitlab/NamespacedClass
- def self.all_connection_pools
- ::ActiveRecord::Base.connection_handler.all_connection_pools
+ def self.all_connection_classes
+ @all_connection_classes ||= [ActiveRecord::Base] + ActiveRecord::Base.descendants.select(&:connection_class?) # rubocop: disable Database/MultipleDatabases
end
def self.begin_transaction
- self.all_connection_pools.each do |connection_pool|
- connection_pool.connection.begin_transaction(joinable: false)
+ self.all_connection_classes.each do |connection_class|
+ connection_class.connection.begin_transaction(joinable: false)
end
end
def self.rollback_transaction
- self.all_connection_pools.each do |connection_pool|
- if connection_pool.connection.open_transactions.zero?
+ self.all_connection_classes.each do |connection_class|
+ if connection_class.connection.open_transactions.zero?
warn "!!! before_all transaction has been already rollbacked and " \
"could work incorrectly"
next
end
- connection_pool.connection.rollback_transaction
+ connection_class.connection.rollback_transaction
end
end
end