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:
Diffstat (limited to 'spec/lib/gitlab/database/partitioning_spec.rb')
-rw-r--r--spec/lib/gitlab/database/partitioning_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/partitioning_spec.rb b/spec/lib/gitlab/database/partitioning_spec.rb
index e654cb65452..8724716dd3d 100644
--- a/spec/lib/gitlab/database/partitioning_spec.rb
+++ b/spec/lib/gitlab/database/partitioning_spec.rb
@@ -112,6 +112,24 @@ RSpec.describe Gitlab::Database::Partitioning, feature_category: :database do
end
end
+ context 'without ci database' do
+ it 'only creates partitions for main database' do
+ skip_if_database_exists(:ci)
+
+ allow(Gitlab::Database::Partitioning::PartitionManager).to receive(:new).and_call_original
+
+ # Also, in the case where `ci` database is shared with `main` database,
+ # check that we do not run PartitionManager again for ci connection as
+ # that is redundant.
+ expect(Gitlab::Database::Partitioning::PartitionManager).not_to receive(:new)
+ .with(anything, connection: ci_connection).and_call_original
+
+ expect { described_class.sync_partitions(models) }
+ .to change { find_partitions(table_names.first, conn: main_connection).size }.from(0)
+ .and change { find_partitions(table_names.last, conn: main_connection).size }.from(0)
+ end
+ end
+
context 'when no partitioned models are given' do
it 'manages partitions for each registered model' do
described_class.register_models([models.first])