Automatically extract BBM spec schema from finalized_by
What does this MR do and why?
Automatically extract BBM spec schema from finalized_by
Since the ensure_batched_background_migration_is_finished
call should
correspond to the latest version of the schema we need to support for a
given batched background migration we can assume that we can lock the
spec to only run against that schema.
Now that we have introduced a finalized_by
key in our
`db/docs/batched_background_migrations/*.yml' files we can use this to
automatically work out what schema to use running tests for a batched
background migration.
This work is also to support an effort to automatically finalize a
lot of batched background migrations which ultimately is holding up
#429165 (closed). Saving us the
effort of setting schema
in the spec will simplify this work.
This merge request also updates a specific spec
migrate_human_user_type_spec just so that we have an example to
demonstrate this works. This migration is already finalized in
db/post_migrate/20230523101514_finalize_user_type_migration.rb
so we
add that version number to the db/docs
file for this migration job.
Without locking the version in this spec it fails due to new required
columns not being set. This demonstrates the new functionality to
automatically select the schema version works.
This MR also moves some logic out of spec_helper
and into
spec/support/helpers/migrations_helpers
because it makes more sense
there.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
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.