Disable the backfilling mechanism when tracking DB is not available

parent 09a30afd
......@@ -6,6 +6,7 @@ class GeoBackfillWorker
BATCH_SIZE = 100.freeze
def perform
return unless Rails.configuration.respond_to?(:geo_database)
return unless Gitlab::Geo.primary_node.present?
start_time = Time.now
......
......@@ -18,6 +18,22 @@ describe Geo::GeoBackfillWorker, services: true do
subject.perform
end
it 'does not perform Geo::RepositoryBackfillService when tracking DB is not available' do
allow(Rails.configuration).to receive(:respond_to?).with(:geo_database) { false }
expect(Geo::RepositoryBackfillService).not_to receive(:new)
subject.perform
end
it 'does not perform Geo::RepositoryBackfillService when primary node does not exists' do
allow(Gitlab::Geo).to receive(:primary_node) { nil }
expect(Geo::RepositoryBackfillService).not_to receive(:new)
subject.perform
end
it 'does not perform Geo::RepositoryBackfillService when node is disabled' do
allow_any_instance_of(GeoNode).to receive(:enabled?) { false }
......
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