Fix stuck jobs tests

This commit is contained in:
Kamil Trzcinski 2017-11-27 11:56:06 +01:00
parent 07c7ba1bf4
commit 6c1a429420

View file

@ -106,7 +106,7 @@ describe StuckCiJobsWorker do
end end
it 'does drop job' do it 'does drop job' do
expect_any_instance_of(Ci::Build).to receive(:drop) expect_any_instance_of(Ci::Build).to receive(:drop).and_call_original
worker.perform worker.perform
end end
end end
@ -117,7 +117,7 @@ describe StuckCiJobsWorker do
let(:worker2) { described_class.new } let(:worker2) { described_class.new }
it 'is guard by exclusive lease when executed concurrently' do it 'is guard by exclusive lease when executed concurrently' do
expect(worker).to receive(:drop).at_least(:once) expect(worker).to receive(:drop).at_least(:once).and_call_original
expect(worker2).not_to receive(:drop) expect(worker2).not_to receive(:drop)
worker.perform worker.perform
allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).and_return(false) allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).and_return(false)
@ -125,8 +125,8 @@ describe StuckCiJobsWorker do
end end
it 'can be executed in sequence' do it 'can be executed in sequence' do
expect(worker).to receive(:drop).at_least(:once) expect(worker).to receive(:drop).at_least(:once).and_call_original
expect(worker2).to receive(:drop).at_least(:once) expect(worker2).to receive(:drop).at_least(:once).and_call_original
worker.perform worker.perform
worker2.perform worker2.perform
end end