Log renamed event to the Geo event log when repository is transferred

parent 5a2581d1
module EE
module Projects
module TransferService
private
def execute_system_hooks
raise NotImplementedError unless defined?(super)
super
::Geo::RepositoryRenamedEventStore.new(project,
old_path: project.path, old_path_with_namespace: @old_path).create
end
end
end
end
......@@ -11,6 +11,8 @@ module Projects
include Gitlab::ShellAdapter
TransferError = Class.new(StandardError)
prepend ::EE::Projects::TransferService
def execute(new_namespace)
@new_namespace = new_namespace
......
# rubocop:disable RSpec/FilePath
require 'spec_helper'
describe Projects::TransferService, services: true do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, :repository, namespace: user.namespace) }
subject { described_class.new(project, user) }
before do
group.add_owner(user)
end
context 'when running on a primary node' do
let!(:geo_node) { create(:geo_node, :primary, :current) }
it 'logs an event to the Geo event log' do
expect { subject.execute(group) }.to change(Geo::RepositoryRenamedEvent, :count).by(1)
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