Skip tests for old database migrations (take 2)
What does this MR do and why?
Skip test if migration is older than Gitlab::Database::MIN_SCHEMA_GITLAB_VERSION
.
This is second attempt to implement this after !161544 (merged) which had to be reverted because of the following issues:
- Background migration tests were also skipped
- When old database migration was updated, and its tests skipped,
rspec:undercoverage
job was failing.
In this change we address the former by explicitly checking if the migration being skipped is database migration, and the later by providing a way to execute the test locally when verifying rspec:undercoverage
failures, and updatiing the relevant docs.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- On master, execute
bundle exec rspec spec/migrations/20231107092912_queue_backfill_branch_protection_namespace_setting_spec.rb spec/migrations/20240618093306_queue_fix_synced_epic_work_item_parent_links_spec.rb spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb
- On this branch, execute the same command
bundle exec rspec spec/migrations/20231107092912_queue_backfill_branch_protection_namespace_setting_spec.rb spec/migrations/20240618093306_queue_fix_synced_epic_work_item_parent_links_spec.rb spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb
spec/migrations/20231107092912_queue_backfill_branch_protection_namespace_setting_spec.rb
will be skipped, and the other two tests will be executed. - On this branch, execute
RUN_ALL_MIGRATION_TESTS=1 bundle exec rspec spec/migrations/20231107092912_queue_backfill_branch_protection_namespace_setting_spec.rb spec/migrations/20240618093306_queue_fix_synced_epic_work_item_parent_links_spec.rb spec/lib/gitlab/background_migration/copy_column_using_background_migration_job_spec.rb