diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-23 18:42:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-23 18:42:02 +0000 |
commit | 5a1541a44f745cf9ae4121d6919a1530a7212afe (patch) | |
tree | 3841ea24d9eaa1e5521f168348af3fd409aab962 /spec/lib/object_storage | |
parent | f1bc6c9f752e5dcf11f5798c70498e9ae4a8e3ec (diff) | |
download | gitlab-ce-5a1541a44f745cf9ae4121d6919a1530a7212afe.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-ee
Diffstat (limited to 'spec/lib/object_storage')
-rw-r--r-- | spec/lib/object_storage/config_spec.rb | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/spec/lib/object_storage/config_spec.rb b/spec/lib/object_storage/config_spec.rb index 1361d80fe75..0ead2a1d269 100644 --- a/spec/lib/object_storage/config_spec.rb +++ b/spec/lib/object_storage/config_spec.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true -require 'spec_helper' +require 'fast_spec_helper' require 'rspec-parameterized' +require 'fog/core' RSpec.describe ObjectStorage::Config do using RSpec::Parameterized::TableSyntax @@ -33,9 +34,7 @@ RSpec.describe ObjectStorage::Config do } end - subject do - described_class.new(raw_config.as_json) - end + subject { described_class.new(raw_config.as_json) } describe '#load_provider' do before do @@ -46,10 +45,6 @@ RSpec.describe ObjectStorage::Config do it 'registers AWS as a provider' do expect(Fog.providers.keys).to include(:aws) end - - describe '#fog_connection' do - it { expect(subject.fog_connection).to be_a_kind_of(Fog::AWS::Storage::Real) } - end end context 'with Google' do @@ -64,10 +59,6 @@ RSpec.describe ObjectStorage::Config do it 'registers Google as a provider' do expect(Fog.providers.keys).to include(:google) end - - describe '#fog_connection' do - it { expect(subject.fog_connection).to be_a_kind_of(Fog::Storage::GoogleXML::Real) } - end end context 'with Azure' do @@ -82,10 +73,6 @@ RSpec.describe ObjectStorage::Config do it 'registers AzureRM as a provider' do expect(Fog.providers.keys).to include(:azurerm) end - - describe '#fog_connection' do - it { expect(subject.fog_connection).to be_a_kind_of(Fog::Storage::AzureRM::Real) } - end end end @@ -183,50 +170,6 @@ RSpec.describe ObjectStorage::Config do it { expect(subject.provider).to eq('AWS') } it { expect(subject.aws?).to be true } it { expect(subject.google?).to be false } - - it 'returns the default S3 endpoint' do - subject.load_provider - - expect(subject.s3_endpoint).to eq("https://test-bucket.s3.amazonaws.com") - end - - describe 'with a custom endpoint' do - let(:endpoint) { 'https://my.example.com' } - - before do - credentials[:endpoint] = endpoint - end - - it 'returns the custom endpoint' do - subject.load_provider - - expect(subject.s3_endpoint).to eq(endpoint) - end - end - - context 'with custom S3 host and port' do - where(:host, :port, :scheme, :expected) do - 's3.example.com' | 8080 | nil | 'https://test-bucket.s3.example.com:8080' - 's3.example.com' | 443 | nil | 'https://test-bucket.s3.example.com' - 's3.example.com' | 443 | "https" | 'https://test-bucket.s3.example.com' - 's3.example.com' | nil | nil | 'https://test-bucket.s3.example.com' - 's3.example.com' | 80 | "http" | 'http://test-bucket.s3.example.com' - 's3.example.com' | "bogus" | nil | nil - end - - with_them do - before do - credentials[:host] = host - credentials[:port] = port - credentials[:scheme] = scheme - subject.load_provider - end - - it 'returns expected host' do - expect(subject.s3_endpoint).to eq(expected) - end - end - end end context 'with Google credentials' do |