Commit 1fd26b1b authored by Alex Pooley's avatar Alex Pooley Committed by Mayra Cabrera

Finalize traversal_ids background migrations

Ensure that all traversal_ids column synchronization background
migrations have completed.

Changelog: other
parent 2cefa096
# frozen_string_literal: true
class FinalizeTraversalIdsBackgroundMigrations < Gitlab::Database::Migration[1.0]
def up
finalize_background_migration('BackfillNamespaceTraversalIdsRoots')
finalize_background_migration('BackfillNamespaceTraversalIdsChildren')
end
def down
# no-op
end
end
1d6ed98ad2da7be75e09d853db86905ed1fb1847d387cc6d1980ff5516db06d9
\ No newline at end of file
# frozen_string_literal: true
require 'spec_helper'
require_migration!('finalize_traversal_ids_background_migrations')
RSpec.describe FinalizeTraversalIdsBackgroundMigrations, :migration do
shared_context 'incomplete background migration' do
before do
# Jobs enqueued in Sidekiq.
Sidekiq::Testing.disable! do
BackgroundMigrationWorker.perform_in(10, job_class_name, [1, 2, 100])
BackgroundMigrationWorker.perform_in(20, job_class_name, [3, 4, 100])
end
# Jobs tracked in the database.
# table(:background_migration_jobs).create!(
Gitlab::Database::BackgroundMigrationJob.create!(
class_name: job_class_name,
arguments: [5, 6, 100],
status: Gitlab::Database::BackgroundMigrationJob.statuses['pending']
)
# table(:background_migration_jobs).create!(
Gitlab::Database::BackgroundMigrationJob.create!(
class_name: job_class_name,
arguments: [7, 8, 100],
status: Gitlab::Database::BackgroundMigrationJob.statuses['succeeded']
)
end
end
context 'BackfillNamespaceTraversalIdsRoots background migration' do
let(:job_class_name) { 'BackfillNamespaceTraversalIdsRoots' }
include_context 'incomplete background migration'
before do
migrate!
end
it_behaves_like(
'finalized tracked background migration',
Gitlab::BackgroundMigration::BackfillNamespaceTraversalIdsRoots
)
end
context 'BackfillNamespaceTraversalIdsChildren background migration' do
let(:job_class_name) { 'BackfillNamespaceTraversalIdsChildren' }
include_context 'incomplete background migration'
before do
migrate!
end
it_behaves_like(
'finalized tracked background migration',
Gitlab::BackgroundMigration::BackfillNamespaceTraversalIdsChildren
)
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