Commit f6d596bb authored by Pavlo Strokov's avatar Pavlo Strokov Committed by Rémy Coutable

FindRemoteRepository is storage scoped

The contract of FindRemoteRepository RPC changed and now
it expects 'storage_name' field to be passed.
It is optional as of now, but will be made required after
migrating this RPC from SERVER scope to STORAGE scope.

Related to: https://gitlab.com/gitlab-org/gitaly/-/issues/2442
parent db775720
---
title: FindRemoteRepository is storage scoped
merge_request: 35962
author:
type: added
...@@ -8,9 +8,11 @@ module Gitlab ...@@ -8,9 +8,11 @@ module Gitlab
MAX_MSG_SIZE = 128.kilobytes.freeze MAX_MSG_SIZE = 128.kilobytes.freeze
def self.exists?(remote_url) def self.exists?(remote_url)
request = Gitaly::FindRemoteRepositoryRequest.new(remote: remote_url) storage = GitalyClient.random_storage
response = GitalyClient.call(GitalyClient.random_storage, request = Gitaly::FindRemoteRepositoryRequest.new(remote: remote_url, storage_name: storage)
response = GitalyClient.call(storage,
:remote_service, :remote_service,
:find_remote_repository, request, :find_remote_repository, request,
timeout: GitalyClient.medium_timeout) timeout: GitalyClient.medium_timeout)
......
...@@ -73,8 +73,11 @@ RSpec.describe Gitlab::GitalyClient::RemoteService do ...@@ -73,8 +73,11 @@ RSpec.describe Gitlab::GitalyClient::RemoteService do
describe '.exists?' do describe '.exists?' do
context "when the remote doesn't exist" do context "when the remote doesn't exist" do
let(:url) { 'https://gitlab.com/gitlab-org/ik-besta-niet-of-ik-word-geplaagd.git' } let(:url) { 'https://gitlab.com/gitlab-org/ik-besta-niet-of-ik-word-geplaagd.git' }
let(:storage_name) { 'default' }
it 'returns false' do it 'returns false' do
expect(Gitaly::FindRemoteRepositoryRequest).to receive(:new).with(remote: url, storage_name: storage_name).and_call_original
expect(described_class.exists?(url)).to be(false) expect(described_class.exists?(url)).to be(false)
end 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