debian-mirror-gitlab/lib/gitlab/database/migrations/test_background_runner.rb
2022-07-16 19:58:13 +02:00

32 lines
805 B
Ruby

# frozen_string_literal: true
module Gitlab
module Database
module Migrations
class TestBackgroundRunner < BaseBackgroundRunner
def initialize(result_dir:)
super(result_dir: result_dir)
@job_coordinator = Gitlab::BackgroundMigration.coordinator_for_database(Gitlab::Database::MAIN_DATABASE_NAME)
end
def traditional_background_migrations
@job_coordinator.pending_jobs
end
def jobs_by_migration_name
traditional_background_migrations.group_by { |j| class_name_for_job(j) }
end
private
def run_job(job)
Gitlab::BackgroundMigration.perform(job.args[0], job.args[1])
end
def class_name_for_job(job)
job.args[0]
end
end
end
end
end