diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-12-08 09:09:06 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 20:45:07 +0100 |
commit | 87f11d2cf539d9539b439b54355f0dadaf4ebf76 (patch) | |
tree | 389f5bb28aabfe6a189795fa91611318bb272101 /spec/models/ci/job_artifact_spec.rb | |
parent | 6ca02a41500790b3e9061dd8836540955b9aaf7c (diff) | |
download | gitlab-ce-87f11d2cf539d9539b439b54355f0dadaf4ebf76.tar.gz |
Merge branch 'zj-auto-upload-job-artifacts' into 'master'
Transfer job archives after creation
See merge request gitlab-org/gitlab-ee!3646
Diffstat (limited to 'spec/models/ci/job_artifact_spec.rb')
-rw-r--r-- | spec/models/ci/job_artifact_spec.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb index 0e18a326c68..a10afb98d2b 100644 --- a/spec/models/ci/job_artifact_spec.rb +++ b/spec/models/ci/job_artifact_spec.rb @@ -12,6 +12,64 @@ describe Ci::JobArtifact do it { is_expected.to respond_to(:created_at) } it { is_expected.to respond_to(:updated_at) } + describe 'callbacks' do + subject { create(:ci_job_artifact, :archive) } + + describe '#schedule_migration_to_object_storage' do + context 'when object storage is disabled' do + before do + stub_artifacts_object_storage(enabled: false) + end + + it 'does not schedule the migration' do + expect(ObjectStorageUploadWorker).not_to receive(:perform_async) + + subject + end + end + + context 'when object storage is enabled' do + context 'when background upload is enabled' do + context 'when is licensed' do + before do + stub_artifacts_object_storage(background_upload: true) + end + + it 'schedules the model for migration' do + expect(ObjectStorageUploadWorker).to receive(:perform_async).with('JobArtifactUploader', described_class.name, :file, kind_of(Numeric)) + + subject + end + end + + context 'when is unlicensed' do + before do + stub_artifacts_object_storage(background_upload: true, licensed: false) + end + + it 'does not schedule the migration' do + expect(ObjectStorageUploadWorker).not_to receive(:perform_async) + + subject + end + end + end + + context 'when background upload is disabled' do + before do + stub_artifacts_object_storage(background_upload: false) + end + + it 'schedules the model for migration' do + expect(ObjectStorageUploadWorker).not_to receive(:perform_async) + + subject + end + end + end + end + end + describe '#set_size' do it 'sets the size' do expect(artifact.size).to eq(106365) |