Commit bb34d91d authored by Mark Chao's avatar Mark Chao

Merge branch...

Merge branch '356872-migration-lib-gitlab-background_migration-backfill_draft_status_on_merge_requests-rb-does' into 'master'

Resolve "Migration does not always mark itself as complete"

See merge request gitlab-org/gitlab!84531
parents f9af2df0 75b3bc26
......@@ -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