Commit 60af5d34 authored by Stan Hu's avatar Stan Hu

Merge branch '351728-mergeability-check-remove-guard-clause' into 'master'

Allow mergeability check when merge_status is already checking

See merge request gitlab-org/gitlab!79723
parents cd88e1bc b535f1ff
...@@ -14,8 +14,8 @@ module MergeRequests ...@@ -14,8 +14,8 @@ module MergeRequests
def async_execute def async_execute
return service_error if service_error return service_error if service_error
return unless merge_request.mark_as_checking
merge_request.mark_as_checking
MergeRequestMergeabilityCheckWorker.perform_async(merge_request.id) MergeRequestMergeabilityCheckWorker.perform_async(merge_request.id)
end end
......
...@@ -73,12 +73,10 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar ...@@ -73,12 +73,10 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
let(:merge_request) { create(:merge_request, merge_status: :unchecked, source_project: project, target_project: project) } let(:merge_request) { create(:merge_request, merge_status: :unchecked, source_project: project, target_project: project) }
describe '#async_execute' do describe '#async_execute' do
shared_examples_for 'no job is enqueued' do it 'updates merge status to checking' do
it 'does not enqueue MergeRequestMergeabilityCheckWorker' do
expect(MergeRequestMergeabilityCheckWorker).not_to receive(:perform_async)
described_class.new(merge_request).async_execute described_class.new(merge_request).async_execute
end
expect(merge_request).to be_checking
end end
it 'enqueues MergeRequestMergeabilityCheckWorker' do it 'enqueues MergeRequestMergeabilityCheckWorker' do
...@@ -92,15 +90,11 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar ...@@ -92,15 +90,11 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
allow(Gitlab::Database).to receive(:read_only?) { true } allow(Gitlab::Database).to receive(:read_only?) { true }
end end
it_behaves_like 'no job is enqueued' it 'does not enqueue MergeRequestMergeabilityCheckWorker' do
end expect(MergeRequestMergeabilityCheckWorker).not_to receive(:perform_async)
context 'when merge_status is already checking' do described_class.new(merge_request).async_execute
before do
merge_request.mark_as_checking
end end
it_behaves_like 'no job is enqueued'
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