diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 11:31:16 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 11:31:16 +0000 |
commit | 905c1110b08f93a19661cf42a276c7ea90d0a0ff (patch) | |
tree | 756d138db422392c00471ab06acdff92c5a9b69c /spec/tasks/gitlab/artifacts | |
parent | 50d93f8d1686950fc58dda4823c4835fd0d8c14b (diff) | |
download | gitlab-ce-905c1110b08f93a19661cf42a276c7ea90d0a0ff.tar.gz |
Add latest changes from gitlab-org/gitlab@12-4-stable-ee
Diffstat (limited to 'spec/tasks/gitlab/artifacts')
-rw-r--r-- | spec/tasks/gitlab/artifacts/check_rake_spec.rb | 2 | ||||
-rw-r--r-- | spec/tasks/gitlab/artifacts/migrate_rake_spec.rb | 44 |
2 files changed, 44 insertions, 2 deletions
diff --git a/spec/tasks/gitlab/artifacts/check_rake_spec.rb b/spec/tasks/gitlab/artifacts/check_rake_spec.rb index d495b08aca0..04015f0e21a 100644 --- a/spec/tasks/gitlab/artifacts/check_rake_spec.rb +++ b/spec/tasks/gitlab/artifacts/check_rake_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rake_helper' describe 'gitlab:artifacts rake tasks' do diff --git a/spec/tasks/gitlab/artifacts/migrate_rake_spec.rb b/spec/tasks/gitlab/artifacts/migrate_rake_spec.rb index be69c10d7c8..55bfb7acd9d 100644 --- a/spec/tasks/gitlab/artifacts/migrate_rake_spec.rb +++ b/spec/tasks/gitlab/artifacts/migrate_rake_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rake_helper' describe 'gitlab:artifacts namespace rake task' do @@ -11,10 +13,11 @@ describe 'gitlab:artifacts namespace rake task' do stub_artifacts_object_storage(enabled: object_storage_enabled) end - subject { run_rake_task('gitlab:artifacts:migrate') } + describe 'gitlab:artifacts:migrate' do + subject { run_rake_task('gitlab:artifacts:migrate') } - context 'job artifacts' do let!(:artifact) { create(:ci_job_artifact, :archive, file_store: store) } + let!(:job_trace) { create(:ci_job_artifact, :trace, file_store: store) } context 'when local storage is used' do let(:store) { ObjectStorage::Store::LOCAL } @@ -27,6 +30,7 @@ describe 'gitlab:artifacts namespace rake task' do subject expect(artifact.reload.file_store).to eq(ObjectStorage::Store::REMOTE) + expect(job_trace.reload.file_store).to eq(ObjectStorage::Store::REMOTE) end end @@ -37,6 +41,7 @@ describe 'gitlab:artifacts namespace rake task' do subject expect(artifact.reload.file_store).to eq(ObjectStorage::Store::REMOTE) + expect(job_trace.reload.file_store).to eq(ObjectStorage::Store::REMOTE) end end @@ -45,6 +50,7 @@ describe 'gitlab:artifacts namespace rake task' do subject expect(artifact.reload.file_store).to eq(ObjectStorage::Store::LOCAL) + expect(job_trace.reload.file_store).to eq(ObjectStorage::Store::LOCAL) end end end @@ -57,6 +63,40 @@ describe 'gitlab:artifacts namespace rake task' do subject expect(artifact.reload.file_store).to eq(ObjectStorage::Store::REMOTE) + expect(job_trace.reload.file_store).to eq(ObjectStorage::Store::REMOTE) + end + end + end + + describe 'gitlab:artifacts:migrate_to_local' do + let(:object_storage_enabled) { true } + + subject { run_rake_task('gitlab:artifacts:migrate_to_local') } + + let!(:artifact) { create(:ci_job_artifact, :archive, file_store: store) } + let!(:job_trace) { create(:ci_job_artifact, :trace, file_store: store) } + + context 'when remote storage is used' do + let(:store) { ObjectStorage::Store::REMOTE } + + context 'and job has remote file store defined' do + it "migrates file to local storage" do + subject + + expect(artifact.reload.file_store).to eq(ObjectStorage::Store::LOCAL) + expect(job_trace.reload.file_store).to eq(ObjectStorage::Store::LOCAL) + end + end + end + + context 'when local storage is used' do + let(:store) { ObjectStorage::Store::LOCAL } + + it 'file stays on local storage' do + subject + + expect(artifact.reload.file_store).to eq(ObjectStorage::Store::LOCAL) + expect(job_trace.reload.file_store).to eq(ObjectStorage::Store::LOCAL) end end end |