Commit 75b3bc26 authored by Kerri Miller's avatar Kerri Miller Committed by Mark Chao

Remove early exit to allow marking as complete

The early exit allowed some jobs to fail to be marked as complete.

Changelog: fixed
parent 5e38f7f9
......@@ -22,8 +22,6 @@ module Gitlab
def perform(start_id, end_id)
eligible_mrs = MergeRequest.eligible.where(id: start_id..end_id).pluck(:id)
return if eligible_mrs.empty?
eligible_mrs.each_slice(10) do |slice|
MergeRequest.where(id: slice).update_all(draft: true)
end
......
......@@ -50,5 +50,19 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillDraftStatusOnMergeRequests,
subject.perform(mr_ids.first, mr_ids.last)
end
it_behaves_like 'marks background migration job records' do
let!(:non_eligible_mrs) do
Array.new(2) do
create_merge_request(
title: "Not a d-r-a-f-t 1",
draft: false,
state_id: 1
)
end
end
let(:arguments) { [non_eligible_mrs.first.id, non_eligible_mrs.last.id] }
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