Commit edae2f1c authored by Sean McGivern's avatar Sean McGivern

Merge branch 'tc-geo-fix-prune-worker-nil' into 'master'

Prunes whole Geo event when there's only a primary

Closes #9712

See merge request gitlab-org/gitlab-ee!9630
parents 1bc31259 4cc13e63
......@@ -13,7 +13,7 @@ module Geo
return if Gitlab::Database.read_only?
return unless Gitlab::Database.healthy?
unless ::GeoNode.any?
unless ::GeoNode.secondary_nodes.any?
Geo::PruneEventLogService.new(:all).execute
return
end
......
---
title: Prunes whole Geo event when there's only a primary
merge_request: 9630
author:
type: fixed
......@@ -59,9 +59,21 @@ describe Geo::PruneEventLogWorker, :geo do
worker.perform
end
context 'no Geo nodes' do
context 'no Geo secondary nodes' do
before do
secondary.destroy
end
it 'deletes everything from the Geo event log' do
create_list(:geo_event_log, 2)
expect(Geo::PruneEventLogService).to receive(:new).with(:all).and_call_original
worker.perform
end
context 'no Geo primary node' do
before do
primary.destroy
end
......@@ -73,6 +85,7 @@ describe Geo::PruneEventLogWorker, :geo do
worker.perform
end
end
end
context 'multiple secondary nodes' do
set(:secondary2) { create(:geo_node) }
......
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