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 ...@@ -13,7 +13,7 @@ module Geo
return if Gitlab::Database.read_only? return if Gitlab::Database.read_only?
return unless Gitlab::Database.healthy? return unless Gitlab::Database.healthy?
unless ::GeoNode.any? unless ::GeoNode.secondary_nodes.any?
Geo::PruneEventLogService.new(:all).execute Geo::PruneEventLogService.new(:all).execute
return return
end 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 ...@@ -59,9 +59,21 @@ describe Geo::PruneEventLogWorker, :geo do
worker.perform worker.perform
end end
context 'no Geo nodes' do context 'no Geo secondary nodes' do
before do before do
secondary.destroy 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 primary.destroy
end end
...@@ -73,6 +85,7 @@ describe Geo::PruneEventLogWorker, :geo do ...@@ -73,6 +85,7 @@ describe Geo::PruneEventLogWorker, :geo do
worker.perform worker.perform
end end
end end
end
context 'multiple secondary nodes' do context 'multiple secondary nodes' do
set(:secondary2) { create(:geo_node) } 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