Test sampled jobs from background migrations
What does this MR do and why?
Describe in detail what your merge request does and why.
This is one component of a first iteration in testing background migrations in the gitlab-com-database-testing pipeline (see gitlab-org/database-team/gitlab-com-database-testing#41 (closed)).
The code added here is not yet called anywhere in the gitlab project, but will be used by the database testing pipeline.
To use it, the testing pipeline will be modified to inject a fake post-migration with a timestamp of all 9s and the following code:
class TestBackgroundMigrations < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
Gitlab::Database::Migrations::TestBackgroundRunner.new.run_jobs(for_duration: 15.minutes) # or some other duration
end
end
The testing pipeline already support for injecting patches, see here.
This will then run after all other migrations in the testing pipeline, and provide information about background migrations.
Later iterations will move this from a migration in the testing pipeline to a dedicated rake task, record data about individual background migration runs, then present that data in a more useful way.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.