diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/models/ci/build_trace_chunks/fog_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/models/ci/build_trace_chunks/fog_spec.rb')
-rw-r--r-- | spec/models/ci/build_trace_chunks/fog_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/models/ci/build_trace_chunks/fog_spec.rb b/spec/models/ci/build_trace_chunks/fog_spec.rb index 20ca0c8b710..bc96e2584cf 100644 --- a/spec/models/ci/build_trace_chunks/fog_spec.rb +++ b/spec/models/ci/build_trace_chunks/fog_spec.rb @@ -74,6 +74,52 @@ RSpec.describe Ci::BuildTraceChunks::Fog do expect(data_store.data(model)).to eq new_data end + + context 'when S3 server side encryption is enabled' do + before do + config = Gitlab.config.artifacts.object_store.to_h + config[:storage_options] = { server_side_encryption: 'AES256' } + allow(data_store).to receive(:object_store_raw_config).and_return(config) + end + + it 'creates a file with attributes' do + expect_next_instance_of(Fog::AWS::Storage::Files) do |files| + expect(files).to receive(:create).with( + hash_including( + key: anything, + body: new_data, + 'x-amz-server-side-encryption' => 'AES256') + ).and_call_original + end + + expect(data_store.data(model)).to be_nil + + data_store.set_data(model, new_data) + + expect(data_store.data(model)).to eq new_data + end + + context 'when ci_live_trace_use_fog_attributes flag is disabled' do + before do + stub_feature_flags(ci_live_trace_use_fog_attributes: false) + end + + it 'does not pass along Fog attributes' do + expect_next_instance_of(Fog::AWS::Storage::Files) do |files| + expect(files).to receive(:create).with( + key: anything, + body: new_data + ).and_call_original + end + + expect(data_store.data(model)).to be_nil + + data_store.set_data(model, new_data) + + expect(data_store.data(model)).to eq new_data + end + end + end end end |