Fix ambiguous stuck ci job worker's spec. Rename lease key of archive

This commit is contained in:
Shinya Maeda 2018-06-01 16:15:41 +09:00
parent 174c892e7e
commit 2522691eda
3 changed files with 5 additions and 3 deletions

View File

@ -215,7 +215,7 @@ module Gitlab
# For ExclusiveLeaseGuard concerns # For ExclusiveLeaseGuard concerns
def lease_key def lease_key
@lease_key ||= self.class.name.underscore + ":archive:#{job.id}" @lease_key ||= "trace:archive:#{job.id}"
end end
# For ExclusiveLeaseGuard concern # For ExclusiveLeaseGuard concern

View File

@ -132,8 +132,10 @@ describe StuckCiJobsWorker do
end end
it 'cancels exclusive lease after worker perform' do 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 worker.perform
expect(Gitlab::ExclusiveLease.new(described_class::EXCLUSIVE_LEASE_KEY, timeout: 1.hour).exists?)
.to be_falsy
end end
end end
end end