Skip to content

Migration name was nil in failure messages

rossfuhrman requested to merge rf-migration-spec-helper-bugfix into master

What does this MR do and why?

Prior to this change, a failing migration spec (due to incorrect arguments) would have a nil migration name in the message:

Failure/Error: expect(migration_name).to be_scheduled_migration_with_multiple_args(vul1.id, vul1.id)
 Migration `` with args `[42, 42]` not scheduled!

With this change, the migration name is populating:

Failure/Error: expect(migration_name).to be_scheduled_migration_with_multiple_args(vul1.id, vul1.id)
 Migration `UpdateVulnerabilityOccurrencesLocation` with args `[46, 46]` not scheduled!

How to set up and validate locally

I discovered this on accident while working on a DB migration.

Changing the arguments of https://gitlab.com/gitlab-org/gitlab/-/blob/f815bc71628dfbc95862c7f3f22b47988172472e/ee/spec/migrations/update_vulnerability_occurrences_location_spec.rb#L45 to be incorrect will demonstrate the problem/fix.

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 rossfuhrman

Merge request reports