Commit 593aeb5b authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'cat-fix-pages-deployment-selective-sync' into 'master'

Fix Geo Pages replication for selective sync

See merge request gitlab-org/gitlab!70190
parents 8782634d fd5fabbc
......@@ -16,6 +16,7 @@ class PagesDeployment < ApplicationRecord
scope :migrated_from_legacy_storage, -> { where(file: MIGRATED_FILE_NAME) }
scope :with_files_stored_locally, -> { where(file_store: ::ObjectStorage::Store::LOCAL) }
scope :with_files_stored_remotely, -> { where(file_store: ::ObjectStorage::Store::REMOTE) }
scope :project_id_in, ->(ids) { where(project_id: ids) }
validates :file, presence: true
validates :file_store, presence: true, inclusion: { in: ObjectStorage::SUPPORTED_STORES }
......
......@@ -37,8 +37,50 @@ RSpec.shared_examples 'a replicable model' do
stub_current_geo_node(secondary)
end
it 'is implemented' do
expect(model_record.class.replicables_for_current_secondary(model_record.id)).to be_an(ActiveRecord::Relation)
shared_examples 'is implemented and returns a valid relation' do
it 'is implemented' do
expect(model_record.class.replicables_for_current_secondary(model_record.id)).to be_an(ActiveRecord::Relation)
end
end
context 'when syncing object storage is enabled' do
before do
secondary.update!(sync_object_storage: true)
end
it_behaves_like 'is implemented and returns a valid relation'
end
context 'when syncing object storage is disabled' do
before do
secondary.update!(sync_object_storage: false)
end
it_behaves_like 'is implemented and returns a valid relation'
end
context 'with selective sync disabled' do
before do
secondary.update!(selective_sync_type: nil)
end
it_behaves_like 'is implemented and returns a valid relation'
end
context 'with selective sync enabled for namespaces' do
before do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [build(:group)])
end
it_behaves_like 'is implemented and returns a valid relation'
end
context 'with selective sync enabled for shards' do
before do
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken'])
end
it_behaves_like 'is implemented and returns a valid relation'
end
end
end
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