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 ...@@ -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
......
...@@ -35,7 +35,7 @@ describe Ci::RescueStaleLiveTraceWorker do ...@@ -35,7 +35,7 @@ describe Ci::RescueStaleLiveTraceWorker do
context 'when build has both archived trace and live trace' 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) } let!(:build2) { create(:ci_build, :success, :trace_live, finished_at: 2.days.ago) }
it 'archives only available targets' do it 'archives only available targets' do
subject subject
......
...@@ -132,8 +132,10 @@ describe StuckCiJobsWorker do ...@@ -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
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