Commit 2fc9c7be authored by Nick Thomas's avatar Nick Thomas

Geo support for rewriting internal references

parent 0cf0e59f
......@@ -50,3 +50,5 @@ module Projects
end
end
end
::Projects::CleanupService.prepend(::EE::Projects::CleanupService)
module EE
module Projects
module CleanupService
extend ::Gitlab::Utils::Override
override :execute
def execute
super
project.repository.log_geo_updated_event
end
end
end
end
require 'spec_helper'
describe Projects::CleanupService do
include ::EE::GeoHelpers
let(:project) { create(:project, :repository, bfg_object_map: fixture_file_upload('spec/fixtures/bfg_object_map.txt')) }
let(:object_map) { project.bfg_object_map }
let(:primary) { create(:geo_node, :primary) }
subject(:service) { described_class.new(project) }
describe '#execute' do
before do
stub_current_geo_node(primary)
end
it 'sends a Geo notification about the update on success' do
expect_next_instance_of(Geo::RepositoryUpdatedService) do |service|
expect(service).to receive(:execute)
end
service.execute
end
it 'does not send a Geo notification if the update fails' do
object_map.remove!
expect(Geo::RepositoryUpdatedService).not_to receive(:new)
expect { service.execute }.to raise_error(/object map/)
expect(Geo::RepositoryUpdatedEvent.count).to eq(0)
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