Fix ambiguous stuck ci job worker's spec. Rename lease key of archive
This commit is contained in:
parent
174c892e7e
commit
2522691eda
3 changed files with 5 additions and 3 deletions
|
@ -215,7 +215,7 @@ module Gitlab
|
|||
|
||||
# For ExclusiveLeaseGuard concerns
|
||||
def lease_key
|
||||
@lease_key ||= self.class.name.underscore + ":archive:#{job.id}"
|
||||
@lease_key ||= "trace:archive:#{job.id}"
|
||||
end
|
||||
|
||||
# For ExclusiveLeaseGuard concern
|
||||
|
|
|
@ -35,7 +35,7 @@ describe Ci::RescueStaleLiveTraceWorker do
|
|||
|
||||
context 'when build has both archived trace and live trace' do
|
||||
let!(:build2) { create(:ci_build, :success, :trace_live, finished_at: 2.days.ago) }
|
||||
|
||||
|
||||
it 'archives only available targets' do
|
||||
subject
|
||||
|
||||
|
|
|
@ -132,8 +132,10 @@ describe StuckCiJobsWorker do
|
|||
end
|
||||
|
||||
it 'cancels exclusive lease after worker perform' do
|
||||
expect(Gitlab::ExclusiveLease).to receive(:cancel).with(described_class::EXCLUSIVE_LEASE_KEY, exclusive_lease_uuid)
|
||||
worker.perform
|
||||
|
||||
expect(Gitlab::ExclusiveLease.new(described_class::EXCLUSIVE_LEASE_KEY, timeout: 1.hour).exists?)
|
||||
.to be_falsy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue