Commit fb2d9035 authored by Rémy Coutable's avatar Rémy Coutable

Include background migrations in the migration test level

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent db775720
...@@ -118,8 +118,8 @@ ...@@ -118,8 +118,8 @@
- "{,ee/}spec/**/*.rb" - "{,ee/}spec/**/*.rb"
.db-patterns: &db-patterns .db-patterns: &db-patterns
- "{,ee/}{db}/**/*" - "{,ee/}{,spec/}{db,migrations}/**/*"
- "{,ee}/spec/{db,migrations}/**/*" - "{,ee/}{,spec/}lib/{,ee/}gitlab/background_migration/**/*"
.backstage-patterns: &backstage-patterns .backstage-patterns: &backstage-patterns
- "Dangerfile" - "Dangerfile"
......
...@@ -93,8 +93,14 @@ module Quality ...@@ -93,8 +93,14 @@ module Quality
private private
def migration_and_background_migration_folders
TEST_LEVEL_FOLDERS.fetch(:migration) + TEST_LEVEL_FOLDERS.fetch(:background_migration)
end
def folders_pattern(level) def folders_pattern(level)
case level case level
when :migration
"{#{migration_and_background_migration_folders.join(',')}}"
# Geo specs aren't in a specific folder, but they all have the :geo tag, so we must search for them globally # Geo specs aren't in a specific folder, but they all have the :geo tag, so we must search for them globally
when :all, :geo when :all, :geo
'**' '**'
...@@ -105,6 +111,8 @@ module Quality ...@@ -105,6 +111,8 @@ module Quality
def folders_regex(level) def folders_regex(level)
case level case level
when :migration
"(#{migration_and_background_migration_folders.join('|')})"
# Geo specs aren't in a specific folder, but they all have the :geo tag, so we must search for them globally # Geo specs aren't in a specific folder, but they all have the :geo tag, so we must search for them globally
when :all, :geo when :all, :geo
'' ''
......
...@@ -28,7 +28,7 @@ RSpec.describe Quality::TestLevel do ...@@ -28,7 +28,7 @@ RSpec.describe Quality::TestLevel do
context 'when level is migration' do context 'when level is migration' do
it 'returns a pattern' do it 'returns a pattern' do
expect(subject.pattern(:migration)) expect(subject.pattern(:migration))
.to eq("spec/{migrations}{,/**/}*_spec.rb") .to eq("spec/{migrations,lib/gitlab/background_migration,lib/ee/gitlab/background_migration}{,/**/}*_spec.rb")
end end
end end
...@@ -96,7 +96,7 @@ RSpec.describe Quality::TestLevel do ...@@ -96,7 +96,7 @@ RSpec.describe Quality::TestLevel do
context 'when level is migration' do context 'when level is migration' do
it 'returns a regexp' do it 'returns a regexp' do
expect(subject.regexp(:migration)) expect(subject.regexp(:migration))
.to eq(%r{spec/(migrations)}) .to eq(%r{spec/(migrations|lib/gitlab/background_migration|lib/ee/gitlab/background_migration)})
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment