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>2022-12-07 21:09:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-07 21:09:16 +0300
commit38e6d9291369e346f33f52a5ab656b787ce0a2c0 (patch)
treec5137121d6cc0ff5d9372252569c10a05164b794 /spec/initializers
parent2a501f63df96252295df7efe53880c5e78fa22b5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers')
-rw-r--r--spec/initializers/database_config_spec.rb30
1 files changed, 24 insertions, 6 deletions
diff --git a/spec/initializers/database_config_spec.rb b/spec/initializers/database_config_spec.rb
index 230f1296760..bbb5e7b1923 100644
--- a/spec/initializers/database_config_spec.rb
+++ b/spec/initializers/database_config_spec.rb
@@ -7,15 +7,33 @@ RSpec.describe 'Database config initializer', :reestablished_active_record_base
load Rails.root.join('config/initializers/database_config.rb')
end
- it 'retains the correct database name for the connection' do
- previous_db_name = ApplicationRecord.connection.pool.db_config.name
+ shared_examples 'does not change connection attributes' do
+ it 'retains the correct database name for connection' do
+ previous_db_name = database_base_model.connection.pool.db_config.name
- subject
+ subject
- expect(ApplicationRecord.connection.pool.db_config.name).to eq(previous_db_name)
+ expect(database_base_model.connection.pool.db_config.name).to eq(previous_db_name)
+ end
+
+ it 'does not overwrite custom pool settings' do
+ expect { subject }.not_to change { database_base_model.connection_db_config.pool }
+ end
+ end
+
+ context 'when main database connection' do
+ let(:database_base_model) { Gitlab::Database.database_base_models[:main] }
+
+ it_behaves_like 'does not change connection attributes'
end
- it 'does not overwrite custom pool settings' do
- expect { subject }.not_to change { ActiveRecord::Base.connection_db_config.pool }
+ context 'when ci database connection' do
+ before do
+ skip_if_multiple_databases_not_setup
+ end
+
+ let(:database_base_model) { Gitlab::Database.database_base_models[:ci] }
+
+ it_behaves_like 'does not change connection attributes'
end
end