diff options
Diffstat (limited to 'spec/support/shared_examples/ci_trace_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/ci_trace_shared_examples.rb | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/spec/support/shared_examples/ci_trace_shared_examples.rb b/spec/support/shared_examples/ci_trace_shared_examples.rb index a3a0b2d0eb5..59efce1b5f0 100644 --- a/spec/support/shared_examples/ci_trace_shared_examples.rb +++ b/spec/support/shared_examples/ci_trace_shared_examples.rb @@ -234,20 +234,29 @@ shared_examples_for 'common trace features' do context 'when build status is success' do let!(:build) { create(:ci_build, :success, :trace_live) } - it 'archives a trace' do - subject - - expect(build.job_artifacts_trace).to be_exist + it 'does not have an archived trace yet' do + expect(build.job_artifacts_trace).to be_nil end - context 'when anothe process had already been archiving', :clean_gitlab_redis_shared_state do - before do - Gitlab::ExclusiveLease.new("trace:archive:#{trace.job.id}", timeout: 1.hour).try_obtain - end + context 'when archives' do + it 'has an archived trace' do + subject - it 'prevents multiple archiving' do build.reload - expect(build.job_artifacts_trace).to be_nil + expect(build.job_artifacts_trace).to be_exist + end + + context 'when anothe process had already been archiving', :clean_gitlab_redis_shared_state do + before do + Gitlab::ExclusiveLease.new("trace:archive:#{trace.job.id}", timeout: 1.hour).try_obtain + end + + it 'prevents to archive concurently' do + subject + + build.reload + expect(build.job_artifacts_trace).to be_nil + end end end end |