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 https://gitlab.com/gitlab-org/gitlab/-/issues/429165. 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.
显示
- db/docs/batched_background_migrations/migrate_human_user_type.yml 1 个添加, 0 个删除...batched_background_migrations/migrate_human_user_type.yml
- lib/gitlab/database/background_migration/batched_background_migration_dictionary.rb 43 个添加, 0 个删除...ound_migration/batched_background_migration_dictionary.rb
- spec/lib/gitlab/background_migration/migrate_human_user_type_spec.rb 1 个添加, 1 个删除...tlab/background_migration/migrate_human_user_type_spec.rb
- spec/lib/gitlab/database/background_migration/batched_background_migration_dictionary_spec.rb 13 个添加, 0 个删除...migration/batched_background_migration_dictionary_spec.rb
- spec/spec_helper.rb 0 个添加, 5 个删除spec/spec_helper.rb
- spec/support/helpers/migrations_helpers.rb 7 个添加, 0 个删除spec/support/helpers/migrations_helpers.rb
加载中
想要评论请 注册 或 登录