Commit fd81dab1 authored by manojmj's avatar manojmj

Fix AutoMergeProcessWorker failing if merge train service isnt available

This change fixes AutoMergeProcessWorker from failing when
merge train service is not available for a merge request
parent 4b02b3cd
---
title: Fixes AutoMergeProcessWorker failing when merge train service is not available
for a merge request
merge_request: 23407
author:
type: fixed
......@@ -13,7 +13,7 @@ module AutoMerge
merge_train_service = AutoMerge::MergeTrainService.new(project, merge_request.merge_user)
return abort(merge_request) unless merge_train_service.available_for?(merge_request)
return abort(merge_request, 'This merge request cannot be added to the merge train') unless merge_train_service.available_for?(merge_request)
merge_train_service.execute(merge_request)
end
......
......@@ -61,7 +61,11 @@ describe AutoMerge::AddToMergeTrainWhenPipelineSucceedsService do
end
it 'aborts auto merge' do
expect(service).to receive(:abort).once
expect(service).to receive(:abort).once.and_call_original
expect(SystemNoteService)
.to receive(:abort_add_to_merge_train_when_pipeline_succeeds).once
.with(merge_request, project, user, 'This merge request cannot be added to the merge train')
subject
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