Commit f8af3aba authored by Gabriel Mazetto's avatar Gabriel Mazetto

Make primary_ssh_path_prefix public

parent 11aea03f
......@@ -29,6 +29,12 @@ module Geo
@lease_key ||= "#{LEASE_KEY_PREFIX}:#{type}:#{project.id}"
end
def primary_ssh_path_prefix
@primary_ssh_path_prefix ||= Gitlab::Geo.primary_node.clone_url_prefix.tap do |prefix|
raise EmptyCloneUrlPrefixError, 'Missing clone_url_prefix in the primary node' unless prefix.present?
end
end
private
def sync_repository
......@@ -78,12 +84,6 @@ module Geo
self.class.type
end
def primary_ssh_path_prefix
@primary_ssh_path_prefix ||= Gitlab::Geo.primary_node.clone_url_prefix.tap do |prefix|
raise EmptyCloneUrlPrefixError, 'Missing clone_url_prefix in the primary node' unless prefix.present?
end
end
def log(message)
Rails.logger.info("#{self.class.name}: #{message} for project #{project.path_with_namespace} (#{project.id})")
end
......
......@@ -21,11 +21,11 @@ describe Geo::BaseSyncService, services: true do
it 'raises exception when clone_url_prefix is nil' do
allow_any_instance_of(GeoNode).to receive(:clone_url_prefix) { nil }
expect { subject.send(:primary_ssh_path_prefix) }.to raise_error Geo::EmptyCloneUrlPrefixError
expect { subject.primary_ssh_path_prefix }.to raise_error Geo::EmptyCloneUrlPrefixError
end
it 'returns the prefix defined in the primary node' do
expect(subject.send(:primary_ssh_path_prefix)).to eq('git@localhost:')
expect(subject.primary_ssh_path_prefix).to eq('git@localhost:')
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