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

Merge branch 'elasticsearch-via-gitaly-ee' into 'master'

Add connection_data method to Gitaly client

See merge request gitlab-org/gitlab-ce!24669
parents 51441b97 e3cacb95
...@@ -133,7 +133,11 @@ module Gitlab ...@@ -133,7 +133,11 @@ module Gitlab
end end
def self.address_metadata(storage) def self.address_metadata(storage)
Base64.strict_encode64(JSON.dump({ storage => { 'address' => address(storage), 'token' => token(storage) } })) Base64.strict_encode64(JSON.dump(storage => connection_data(storage)))
end
def self.connection_data(storage)
{ 'address' => address(storage), 'token' => token(storage) }
end end
# All Gitaly RPC call sites should use GitalyClient.call. This method # All Gitaly RPC call sites should use GitalyClient.call. This method
......
...@@ -119,6 +119,15 @@ describe Gitlab::GitalyClient do ...@@ -119,6 +119,15 @@ describe Gitlab::GitalyClient do
end end
end end
describe '.connection_data' do
it 'returns connection data' do
address = 'tcp://localhost:9876'
stub_repos_storages address
expect(described_class.connection_data('default')).to eq({ 'address' => address, 'token' => 'secret' })
end
end
describe 'allow_n_plus_1_calls' do describe 'allow_n_plus_1_calls' do
context 'when RequestStore is enabled', :request_store do context 'when RequestStore is enabled', :request_store do
it 'returns the result of the allow_n_plus_1_calls block' do it 'returns the result of the allow_n_plus_1_calls block' do
......
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