Skip to content

Fix hard-coded database IDs in background migration spec

Stan Hu requested to merge sh-fix-background-migration-spec into master

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

  1. Run gdk psql -d gitlabhq_test.
  2. Bump up the sequence number: ALTER SEQUENCE merge_requests_id_seq RESTART WITH 200;
  3. 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.

Edited by Stan Hu

Merge request reports

Loading