Commit 6edcc964 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'fix-gitaly-client-storage-settings-gitaly_address-method' into 'master'

Fix gitaly_address method

See merge request gitlab-org/gitlab!18151
parents dd2b496a 30cbc3ef
...@@ -53,7 +53,7 @@ module Gitlab ...@@ -53,7 +53,7 @@ module Gitlab
@legacy_disk_path = File.expand_path(storage['path'], Rails.root) if storage['path'] @legacy_disk_path = File.expand_path(storage['path'], Rails.root) if storage['path']
storage['path'] = Deprecated storage['path'] = Deprecated
@hash = storage @hash = storage.with_indifferent_access
end end
def gitaly_address def gitaly_address
......
...@@ -27,6 +27,38 @@ describe Gitlab::GitalyClient::StorageSettings do ...@@ -27,6 +27,38 @@ describe Gitlab::GitalyClient::StorageSettings do
end end
end end
describe '.gitaly_address' do
context 'when the storage settings have no gitaly address but one is requested' do
it 'raises an error' do
expect do
described_class.new("path" => Rails.root).gitaly_address
end.to raise_error("key not found: \"gitaly_address\"")
end
end
context 'when the storage settings have a gitaly address and one is requested' do
it 'returns the setting value' do
expect(described_class.new("path" => Rails.root, "gitaly_address" => "test").gitaly_address).to eq("test")
end
end
context 'when the storage settings have a gitaly address keyed symbolically' do
it 'raises no error' do
expect do
described_class.new("path" => Rails.root, :gitaly_address => "test").gitaly_address
end.not_to raise_error
end
end
context 'when the storage settings have a gitaly address keyed with a string' do
it 'raises no error' do
expect do
described_class.new("path" => Rails.root, "gitaly_address" => "test").gitaly_address
end.not_to raise_error
end
end
end
describe '.disk_access_denied?' do describe '.disk_access_denied?' do
context 'when Rugged is enabled', :enable_rugged do context 'when Rugged is enabled', :enable_rugged do
it 'returns false' do it 'returns false' 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