Commit d03ed2f4 authored by Krasimir Angelov's avatar Krasimir Angelov

Merge branch 'fix_connection_leak_load_balancer_spec' into 'master'

Fix fake connection leaking for Ci::ApplicationRecord

See merge request gitlab-org/gitlab!74032
parents 6e799fb4 cce4e322
......@@ -490,11 +490,20 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do
describe 'primary connection re-use', :reestablished_active_record_base do
let(:model) { Ci::ApplicationRecord }
before do
around do |example|
if Gitlab::Database.has_config?(:ci)
example.run
else
# fake additional Database
model.establish_connection(
ActiveRecord::DatabaseConfigurations::HashConfig.new(Rails.env, 'ci', ActiveRecord::Base.connection_db_config.configuration_hash)
)
example.run
# Cleanup connection_specification_name for Ci::ApplicationRecord
model.remove_connection
end
end
describe '#read' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment