diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-13 18:10:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-13 18:10:03 +0300 |
commit | 6df7943512ca90323c69b926404cc561b6305ce2 (patch) | |
tree | 5dbdb697f641358516ddae9b45ab8bae5d58de81 /spec/uploaders/ci | |
parent | 5605efec12c99adf88f641391cb879dedf8fa05e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/uploaders/ci')
-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 |