diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-25 18:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-25 18:09:00 +0300 |
commit | 10cc2d7a724da4c74b9be7efdbd013c1744047ee (patch) | |
tree | 796f228f98bc29ab2cd03f1fbcc6e42adb67d93c /spec/support | |
parent | 6bc190088ee629fca757b135d25e74cc09c9cb9d (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.rb | 32 | ||||
-rw-r--r-- | spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb | 4 |
2 files changed, 2 insertions, 34 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 826ee453919..1be4d9b80a4 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 @@ -152,36 +152,4 @@ RSpec.shared_examples 'model with repository' do it { is_expected.to respond_to(:disk_path) } it { is_expected.to respond_to(:gitlab_shell) } 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(Gitlab::CurrentSettings).to receive(:pick_repository_storage).and_return('picked') - - expect(subject).to eq('picked') - end - - it 'picks from the available storages based on weight', :request_store do - stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - Gitlab::CurrentSettings.expire_current_application_settings - Gitlab::CurrentSettings.current_application_settings - - settings = ApplicationSetting.last - settings.repository_storages_weighted = { 'picked' => 100, 'default' => 0 } - settings.save! - - expect(Gitlab::CurrentSettings.repository_storages_weighted).to eq({ 'default' => 100 }) - expect(subject).to eq('picked') - expect(Gitlab::CurrentSettings.repository_storages_weighted).to eq({ 'default' => 0, 'picked' => 100 }) - end - end end diff --git a/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb b/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb index 4c617f3ba46..4a5f689ec13 100644 --- a/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb +++ b/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb @@ -45,8 +45,8 @@ RSpec.shared_examples 'handles repository moves' do context 'destination_storage_name' do subject { build(repository_storage_factory_key) } - it 'picks storage from ApplicationSetting' do - expect(Gitlab::CurrentSettings).to receive(:pick_repository_storage).and_return('picked').at_least(:once) + it 'can pick new storage' do + expect(Repository).to receive(:pick_storage_shard).and_return('picked').at_least(:once) expect(subject.destination_storage_name).to eq('picked') end |