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>2023-08-18 13:50:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-18 13:50:51 +0300
commitdb384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch)
tree34beaef37df5f47ccbcf5729d7583aae093cffa0 /spec/lib/gitlab/database_spec.rb
parent54fd7b1bad233e3944434da91d257fa7f63c3996 (diff)
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'spec/lib/gitlab/database_spec.rb')
-rw-r--r--spec/lib/gitlab/database_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb
index d51319d462b..0d8fa4dad6d 100644
--- a/spec/lib/gitlab/database_spec.rb
+++ b/spec/lib/gitlab/database_spec.rb
@@ -344,6 +344,33 @@ RSpec.describe Gitlab::Database, feature_category: :database do
end
end
+ describe '.db_config_share_with' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:db_config_name, :db_config_attributes, :expected_db_config_share_with) do
+ 'main' | { database_tasks: true } | nil
+ 'main' | { database_tasks: false } | nil
+ 'ci' | { database_tasks: true } | nil
+ 'ci' | { database_tasks: false } | 'main'
+ 'main_clusterwide' | { database_tasks: true } | nil
+ 'main_clusterwide' | { database_tasks: false } | 'main'
+ '_test_unknown' | { database_tasks: true } | nil
+ '_test_unknown' | { database_tasks: false } | 'main'
+ end
+
+ with_them do
+ it 'returns the expected result' do
+ db_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(
+ Rails.env,
+ db_config_name,
+ db_config_attributes
+ )
+
+ expect(described_class.db_config_share_with(db_config)).to eq(expected_db_config_share_with)
+ end
+ end
+ end
+
describe '.gitlab_schemas_for_connection' do
it 'does return a valid schema depending on a base model used', :request_store do
expect(described_class.gitlab_schemas_for_connection(Project.connection)).to include(:gitlab_main, :gitlab_shared)