We should make sure that all the migration specs use the :migration metadata
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
As explained in https://gitlab.com/gitlab-org/gitlab-ee/issues/4622#note_55084110, not using the :migration metadata can be a problem for migrations specs.
We could simply add a rule in spec/spec_helper.rb:
config.define_derived_metadata(file_path: %r{/spec/}) do |metadata|
location = metadata[:location]
metadata[:api] = true if location =~ %r{/spec/requests/api/}
# do not overwrite type if it's already set
next if metadata.key?(:type)
match = location.match(%r{/spec/([^/]+)/})
metadata[:type] = match[1].singularize.to_sym if match
end
for all the migration specs, we could inject the :migration metadata.
If we do that, I expect a few migrations that use factories to fail, and we'll need to fix that (also see the note below).
Note: Also, using factories is usually also a (potential) problem when using the :migration metadata (there is a dedicated issue to create a cop to prevent that: https://gitlab.com/gitlab-org/gitlab-ce/issues/42090).
Edited by 🤖 GitLab Bot 🤖