Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 03:08:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 03:08:11 +0300
commit23bc19cb73aad969c9636b8b935111645e809e54 (patch)
tree887c9e014f8345f577769db4f75315ca59853b98 /spec/support
parentc4db541c1b2c97ab1eda354ea3899489fe5c33e5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
index d5606e65981..5a5d7c8f038 100644
--- a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
@@ -168,4 +168,37 @@ RSpec.shared_examples 'model with repository' do
it { is_expected.to respond_to(:base_dir) }
it { is_expected.to respond_to(:disk_path) }
end
+
+ describe '.pick_repository_storage' do
+ subject { described_class.pick_repository_storage }
+
+ before do
+ storages = {
+ 'default' => Gitlab::GitalyClient::StorageSettings.new('path' => 'tmp/tests/repositories'),
+ 'picked' => Gitlab::GitalyClient::StorageSettings.new('path' => 'tmp/tests/repositories')
+ }
+ allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
+ end
+
+ it 'picks storage from ApplicationSetting' do
+ expect_next_instance_of(ApplicationSetting) do |instance|
+ expect(instance).to receive(:pick_repository_storage).and_return('picked')
+ end
+
+ expect(subject).to eq('picked')
+ end
+
+ it 'picks from the latest available storage', :request_store do
+ stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
+ Gitlab::CurrentSettings.current_application_settings
+
+ settings = ApplicationSetting.last
+ settings.repository_storages = %w(picked)
+ settings.save!
+
+ expect(Gitlab::CurrentSettings.repository_storages).to eq(%w(default))
+ expect(subject).to eq('picked')
+ expect(Gitlab::CurrentSettings.repository_storages).to eq(%w(picked))
+ end
+ end
end