diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-07-10 09:21:11 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-07-10 09:21:11 +0000 |
commit | c7b8afcd9093bbb56a405a15290ce8f1625988b1 (patch) | |
tree | b96d614c2db051642dae1152812d390ef5c57dd6 /spec/models | |
parent | f5f5a4e6775e4b8dd4cfeea45e026918f7b2a4d3 (diff) | |
parent | 737666a3d121b1bf89861de4445f857256a47949 (diff) | |
download | gitlab-ce-c7b8afcd9093bbb56a405a15290ce8f1625988b1.tar.gz |
Merge branch 'improve-metadata-access-performance' into 'master'
Improve metadata access performance
See merge request gitlab-org/gitlab-ce!20493
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/build_spec.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 234d2d8aa3a..3c96fe76829 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2687,4 +2687,58 @@ describe Ci::Build do end end end + + describe '#artifacts_metadata_entry' do + set(:build) { create(:ci_build, project: project) } + let(:path) { 'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif' } + + before do + stub_artifacts_object_storage + end + + subject { build.artifacts_metadata_entry(path) } + + context 'when using local storage' do + let!(:metadata) { create(:ci_job_artifact, :metadata, job: build) } + + context 'for existing file' do + it 'does exist' do + is_expected.to be_exists + end + end + + context 'for non-existing file' do + let(:path) { 'invalid-file' } + + it 'does not exist' do + is_expected.not_to be_exists + end + end + end + + context 'when using remote storage' do + include HttpIOHelpers + + let!(:metadata) { create(:ci_job_artifact, :remote_store, :metadata, job: build) } + let(:file_path) { expand_fixture_path('ci_build_artifacts_metadata.gz') } + + before do + stub_remote_url_206(metadata.file.url, file_path) + end + + context 'for existing file' do + it 'does exist' do + is_expected.to be_exists + end + end + + context 'for non-existing file' do + let(:path) { 'invalid-file' } + + it 'does not exist' do + is_expected.not_to be_exists + end + end + end + end end |