Commit 2522691e authored by Shinya Maeda's avatar Shinya Maeda

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

parent 174c892e
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment