diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-02-02 16:59:43 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-02-28 22:58:15 +0300 |
commit | a7dae52e9d27adde427ef8aa066c0761071a3cd9 (patch) | |
tree | 8b6229e4e0afe7e71f9754089758cee8acd56cde /spec/uploaders/job_artifact_uploader_spec.rb | |
parent | 45d2c31643017807cb3fc66c0be6e9cad9964faf (diff) |
Merge branch '4163-move-uploads-to-object-storage' into 'master'
Move uploads to object storage
Closes #4163
See merge request gitlab-org/gitlab-ee!3867
Diffstat (limited to 'spec/uploaders/job_artifact_uploader_spec.rb')
-rw-r--r-- | spec/uploaders/job_artifact_uploader_spec.rb | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/spec/uploaders/job_artifact_uploader_spec.rb b/spec/uploaders/job_artifact_uploader_spec.rb index decea35c86d..fda70a8441b 100644 --- a/spec/uploaders/job_artifact_uploader_spec.rb +++ b/spec/uploaders/job_artifact_uploader_spec.rb @@ -1,46 +1,26 @@ require 'spec_helper' describe JobArtifactUploader do - let(:store) { described_class::LOCAL_STORE } + let(:store) { described_class::Store::LOCAL } let(:job_artifact) { create(:ci_job_artifact, file_store: store) } let(:uploader) { described_class.new(job_artifact, :file) } - let(:local_path) { Gitlab.config.artifacts.path } - describe '#store_dir' do - subject { uploader.store_dir } + subject { uploader } - let(:path) { "#{job_artifact.created_at.utc.strftime('%Y_%m_%d')}/#{job_artifact.project_id}/#{job_artifact.id}" } + it_behaves_like "builds correct paths", + store_dir: %r[\h{2}/\h{2}/\h{64}/\d{4}_\d{1,2}_\d{1,2}/\d+/\d+\z], + cache_dir: %r[artifacts/tmp/cache], + work_dir: %r[artifacts/tmp/work] - context 'when using local storage' do - it { is_expected.to start_with(local_path) } - it { is_expected.to match(/\h{2}\/\h{2}\/\h{64}\/\d{4}_\d{1,2}_\d{1,2}\/\d+\/\d+\z/) } - it { is_expected.to end_with(path) } - end - - context 'when using remote storage' do - let(:store) { described_class::REMOTE_STORE } - - before do - stub_artifacts_object_storage - end - - it { is_expected.to match(/\h{2}\/\h{2}\/\h{64}\/\d{4}_\d{1,2}_\d{1,2}\/\d+\/\d+\z/) } - it { is_expected.to end_with(path) } + context "object store is REMOTE" do + before do + stub_artifacts_object_storage end - end - - describe '#cache_dir' do - subject { uploader.cache_dir } - - it { is_expected.to start_with(local_path) } - it { is_expected.to end_with('/tmp/cache') } - end - describe '#work_dir' do - subject { uploader.work_dir } + include_context 'with storage', described_class::Store::REMOTE - it { is_expected.to start_with(local_path) } - it { is_expected.to end_with('/tmp/work') } + it_behaves_like "builds correct paths", + store_dir: %r[\h{2}/\h{2}/\h{64}/\d{4}_\d{1,2}_\d{1,2}/\d+/\d+\z] end context 'file is stored in valid local_path' do @@ -55,7 +35,7 @@ describe JobArtifactUploader do subject { uploader.file.path } - it { is_expected.to start_with(local_path) } + it { is_expected.to start_with("#{uploader.root}/#{uploader.class.base_dir}") } it { is_expected.to include("/#{job_artifact.created_at.utc.strftime('%Y_%m_%d')}/") } it { is_expected.to include("/#{job_artifact.project_id}/") } it { is_expected.to end_with("ci_build_artifacts.zip") } |