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/services/ci/destroy_expired_job_artifacts_service_spec.rb')
-rw-r--r--spec/services/ci/destroy_expired_job_artifacts_service_spec.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb b/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb
index 1c96be42a2f..3d5329811ad 100644
--- a/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb
+++ b/spec/services/ci/destroy_expired_job_artifacts_service_spec.rb
@@ -9,9 +9,10 @@ RSpec.describe Ci::DestroyExpiredJobArtifactsService, :clean_gitlab_redis_shared
subject { service.execute }
let(:service) { described_class.new }
- let!(:artifact) { create(:ci_job_artifact, expire_at: 1.day.ago) }
- before do
+ let_it_be(:artifact) { create(:ci_job_artifact, expire_at: 1.day.ago) }
+
+ before(:all) do
artifact.job.pipeline.unlocked!
end
@@ -38,7 +39,9 @@ RSpec.describe Ci::DestroyExpiredJobArtifactsService, :clean_gitlab_redis_shared
end
context 'when artifact is not expired' do
- let!(:artifact) { create(:ci_job_artifact, expire_at: 1.day.since) }
+ before do
+ artifact.update_column(:expire_at, 1.day.since)
+ end
it 'does not destroy expired job artifacts' do
expect { subject }.not_to change { Ci::JobArtifact.count }
@@ -46,7 +49,9 @@ RSpec.describe Ci::DestroyExpiredJobArtifactsService, :clean_gitlab_redis_shared
end
context 'when artifact is permanent' do
- let!(:artifact) { create(:ci_job_artifact, expire_at: nil) }
+ before do
+ artifact.update_column(:expire_at, nil)
+ end
it 'does not destroy expired job artifacts' do
expect { subject }.not_to change { Ci::JobArtifact.count }