Fix hard-coded database IDs in background migration spec
What does this MR do and why?
If the next sequence number for merge_requests.id
exceeded 100,
backfill_prepared_at_merge_requests_spec.rb
would fail because the
migration would not be applied because the test worker only operated
between IDs 1 and 100.
To avoid this, we create the merge requests in let!
blocks and then
specify the range of the min and max value of the database IDs.
How to set up and validate locally
- Run
gdk psql -d gitlabhq_test
. - Bump up the sequence number:
ALTER SEQUENCE merge_requests_id_seq RESTART WITH 200;
- Run
bundle exec rspec spec/lib/gitlab/background_migration/backfill_prepared_at_merge_requests_spec.rb
_Numbered steps to set up and validate the change are
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.
Edited by Stan Hu