Commit 31372511 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '215109-checking-ability-to-merge-automatically-stuck' into 'master'

Fix merge requests stuck in checking state

Closes #215109

See merge request gitlab-org/gitlab!30027
parents 8078cf9d 63b538c2
...@@ -163,7 +163,7 @@ class MergeRequest < ApplicationRecord ...@@ -163,7 +163,7 @@ class MergeRequest < ApplicationRecord
state_machine :merge_status, initial: :unchecked do state_machine :merge_status, initial: :unchecked do
event :mark_as_unchecked do event :mark_as_unchecked do
transition [:can_be_merged, :checking, :unchecked] => :unchecked transition [:can_be_merged, :checking, :unchecked] => :unchecked
transition [:cannot_be_merged, :cannot_be_merged_recheck] => :cannot_be_merged_recheck transition [:cannot_be_merged, :cannot_be_merged_rechecking, :cannot_be_merged_recheck] => :cannot_be_merged_recheck
end end
event :mark_as_checking do event :mark_as_checking do
...@@ -200,7 +200,7 @@ class MergeRequest < ApplicationRecord ...@@ -200,7 +200,7 @@ class MergeRequest < ApplicationRecord
# rubocop: enable CodeReuse/ServiceClass # rubocop: enable CodeReuse/ServiceClass
def check_state?(merge_status) def check_state?(merge_status)
[:unchecked, :cannot_be_merged_recheck, :checking].include?(merge_status.to_sym) [:unchecked, :cannot_be_merged_recheck, :checking, :cannot_be_merged_rechecking].include?(merge_status.to_sym)
end end
end end
......
...@@ -3352,7 +3352,7 @@ describe MergeRequest do ...@@ -3352,7 +3352,7 @@ describe MergeRequest do
describe 'check_state?' do describe 'check_state?' do
it 'indicates whether MR is still checking for mergeability' do it 'indicates whether MR is still checking for mergeability' do
state_machine = described_class.state_machines[:merge_status] state_machine = described_class.state_machines[:merge_status]
check_states = [:unchecked, :cannot_be_merged_recheck, :checking] check_states = [:unchecked, :cannot_be_merged_recheck, :cannot_be_merged_rechecking, :checking]
check_states.each do |merge_status| check_states.each do |merge_status|
expect(state_machine.check_state?(merge_status)).to be true expect(state_machine.check_state?(merge_status)).to be true
......
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