diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/uploaders/ci/pipeline_artifact_uploader_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/uploaders/ci/pipeline_artifact_uploader_spec.rb')
-rw-r--r-- | spec/uploaders/ci/pipeline_artifact_uploader_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/uploaders/ci/pipeline_artifact_uploader_spec.rb b/spec/uploaders/ci/pipeline_artifact_uploader_spec.rb new file mode 100644 index 00000000000..0630e9f6546 --- /dev/null +++ b/spec/uploaders/ci/pipeline_artifact_uploader_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::PipelineArtifactUploader do + let(:pipeline_artifact) { create(:ci_pipeline_artifact) } + let(:uploader) { described_class.new(pipeline_artifact, :file) } + + subject { uploader } + + it_behaves_like "builds correct paths", + store_dir: %r[\h{2}/\h{2}/\h{64}/pipelines/\d+/artifacts/\d+], + cache_dir: %r[artifacts/tmp/cache], + work_dir: %r[artifacts/tmp/work] + + context 'when object store is REMOTE' do + before do + stub_artifacts_object_storage(described_class) + end + + include_context 'with storage', described_class::Store::REMOTE + + it_behaves_like 'builds correct paths', store_dir: %r[\h{2}/\h{2}/\h{64}/pipelines/\d+/artifacts/\d+] + end + + context 'when file is stored in valid local_path' do + let(:file) do + fixture_file_upload('spec/fixtures/pipeline_artifacts/code_coverage.json', 'application/json') + end + + before do + uploader.store!(file) + end + + subject { uploader.file.path } + + it { is_expected.to match(%r[#{uploader.root}/#{uploader.class.base_dir}\h{2}/\h{2}/\h{64}/pipelines/#{pipeline_artifact.pipeline_id}/artifacts/#{pipeline_artifact.id}/code_coverage.json]) } + end +end |