diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/lib/object_storage | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/lib/object_storage')
-rw-r--r-- | spec/lib/object_storage/config_spec.rb | 41 | ||||
-rw-r--r-- | spec/lib/object_storage/direct_upload_spec.rb | 22 |
2 files changed, 54 insertions, 9 deletions
diff --git a/spec/lib/object_storage/config_spec.rb b/spec/lib/object_storage/config_spec.rb index a48b5100065..0ead2a1d269 100644 --- a/spec/lib/object_storage/config_spec.rb +++ b/spec/lib/object_storage/config_spec.rb @@ -2,6 +2,7 @@ require 'fast_spec_helper' require 'rspec-parameterized' +require 'fog/core' RSpec.describe ObjectStorage::Config do using RSpec::Parameterized::TableSyntax @@ -35,6 +36,46 @@ RSpec.describe ObjectStorage::Config do subject { described_class.new(raw_config.as_json) } + describe '#load_provider' do + before do + subject.load_provider + end + + context 'with AWS' do + it 'registers AWS as a provider' do + expect(Fog.providers.keys).to include(:aws) + end + end + + context 'with Google' do + let(:credentials) do + { + provider: 'Google', + google_storage_access_key_id: 'GOOGLE_ACCESS_KEY_ID', + google_storage_secret_access_key: 'GOOGLE_SECRET_ACCESS_KEY' + } + end + + it 'registers Google as a provider' do + expect(Fog.providers.keys).to include(:google) + end + end + + context 'with Azure' do + let(:credentials) do + { + provider: 'AzureRM', + azure_storage_account_name: 'azuretest', + azure_storage_access_key: 'ABCD1234' + } + end + + it 'registers AzureRM as a provider' do + expect(Fog.providers.keys).to include(:azurerm) + end + end + end + describe '#credentials' do it { expect(subject.credentials).to eq(credentials) } end diff --git a/spec/lib/object_storage/direct_upload_spec.rb b/spec/lib/object_storage/direct_upload_spec.rb index b11926aeb49..932d579c3cc 100644 --- a/spec/lib/object_storage/direct_upload_spec.rb +++ b/spec/lib/object_storage/direct_upload_spec.rb @@ -211,7 +211,7 @@ RSpec.describe ObjectStorage::DirectUpload do expect(subject[:UseWorkhorseClient]).to be true expect(subject[:RemoteTempObjectID]).to eq(object_name) expect(subject[:ObjectStorage][:Provider]).to eq('AzureRM') - expect(subject[:ObjectStorage][:GoCloudConfig]).to eq({ URL: "azblob://#{bucket_name}" }) + expect(subject[:ObjectStorage][:GoCloudConfig]).to eq({ URL: gocloud_url }) end end @@ -395,20 +395,24 @@ RSpec.describe ObjectStorage::DirectUpload do } end + let(:has_length) { false } + let(:storage_domain) { nil } let(:storage_url) { 'https://azuretest.blob.core.windows.net' } + let(:gocloud_url) { "azblob://#{bucket_name}" } - context 'when length is known' do - let(:has_length) { true } + it_behaves_like 'a valid AzureRM upload' + it_behaves_like 'a valid upload without multipart data' - it_behaves_like 'a valid AzureRM upload' - it_behaves_like 'a valid upload without multipart data' - end + context 'when a custom storage domain is used' do + let(:storage_domain) { 'blob.core.chinacloudapi.cn' } + let(:storage_url) { "https://azuretest.#{storage_domain}" } + let(:gocloud_url) { "azblob://#{bucket_name}?domain=#{storage_domain}" } - context 'when length is unknown' do - let(:has_length) { false } + before do + credentials[:azure_storage_domain] = storage_domain + end it_behaves_like 'a valid AzureRM upload' - it_behaves_like 'a valid upload without multipart data' end end end |