diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-07-09 13:34:18 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-07-09 14:19:52 +0200 |
commit | bc00803af03147452c12e9e2c7e8f0c0cba86f73 (patch) | |
tree | 5d360cbb1422b7d063bffa4fe40bcf1e64b61db7 /spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb | |
parent | 67157de1e4cc482b5321ba2f246bfd80a7893f93 (diff) | |
download | gitlab-ce-bc00803af03147452c12e9e2c7e8f0c0cba86f73.tar.gz |
Access metadata directly from Object Storage
Previously we would pull the file, now, we just stream-it as needed from Object Storage
Diffstat (limited to 'spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb index 6a52ae01b2f..e327399d82d 100644 --- a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb +++ b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb @@ -2,13 +2,21 @@ require 'spec_helper' describe Gitlab::Ci::Build::Artifacts::Metadata do def metadata(path = '', **opts) - described_class.new(metadata_file_path, path, **opts) + described_class.new(metadata_file_stream, path, **opts) end let(:metadata_file_path) do Rails.root + 'spec/fixtures/ci_build_artifacts_metadata.gz' end + let(:metadata_file_stream) do + File.open(metadata_file_path) if metadata_file_path + end + + after do + metadata_file_stream&.close + end + context 'metadata file exists' do describe '#find_entries! empty string' do subject { metadata('').find_entries! } @@ -86,11 +94,21 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do end context 'metadata file does not exist' do - let(:metadata_file_path) { '' } + let(:metadata_file_path) { nil } + + describe '#find_entries!' do + it 'raises error' do + expect { metadata.find_entries! }.to raise_error(described_class::InvalidStreamError, /Invalid stream/) + end + end + end + + context 'metadata file is invalid' do + let(:metadata_file_path) { Rails.root + 'spec/fixtures/ci_build_artifacts.zip' } describe '#find_entries!' do it 'raises error' do - expect { metadata.find_entries! }.to raise_error(Errno::ENOENT) + expect { metadata.find_entries! }.to raise_error(described_class::InvalidStreamError, /not in gzip format/) end end end |