Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/uploaders/ci/pipeline_artifact_uploader_spec.rb')
-rw-r--r--spec/uploaders/ci/pipeline_artifact_uploader_spec.rb39
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