Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2e59bea3
Commit
2e59bea3
authored
Nov 27, 2019
by
Rémy Coutable
Committed by
Stan Hu
Dec 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add migration tests detection to Quality::TestLevel
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
ab6daccf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
lib/quality/test_level.rb
lib/quality/test_level.rb
+8
-0
spec/lib/quality/test_level_spec.rb
spec/lib/quality/test_level_spec.rb
+26
-0
No files found.
lib/quality/test_level.rb
View file @
2e59bea3
...
@@ -36,6 +36,10 @@ module Quality
...
@@ -36,6 +36,10 @@ module Quality
workers
workers
elastic_integration
elastic_integration
]
,
]
,
migration:
%w[
migrations
lib/gitlab/background_migration
]
,
integration:
%w[
integration:
%w[
controllers
controllers
mailers
mailers
...
@@ -62,6 +66,10 @@ module Quality
...
@@ -62,6 +66,10 @@ module Quality
def
level_for
(
file_path
)
def
level_for
(
file_path
)
case
file_path
case
file_path
# Detect migration first since some background migration tests are under
# spec/lib/gitlab/background_migration and tests under spec/lib are unit by default
when
regexp
(
:migration
)
:migration
when
regexp
(
:unit
)
when
regexp
(
:unit
)
:unit
:unit
when
regexp
(
:integration
)
when
regexp
(
:integration
)
...
...
spec/lib/quality/test_level_spec.rb
View file @
2e59bea3
...
@@ -25,6 +25,13 @@ RSpec.describe Quality::TestLevel do
...
@@ -25,6 +25,13 @@ RSpec.describe Quality::TestLevel do
end
end
end
end
context
'when level is migration'
do
it
'returns a pattern'
do
expect
(
subject
.
pattern
(
:migration
))
.
to
eq
(
"spec/{migrations,lib/gitlab/background_migration}{,/**/}*_spec.rb"
)
end
end
context
'when level is integration'
do
context
'when level is integration'
do
it
'returns a pattern'
do
it
'returns a pattern'
do
expect
(
subject
.
pattern
(
:integration
))
expect
(
subject
.
pattern
(
:integration
))
...
@@ -79,6 +86,13 @@ RSpec.describe Quality::TestLevel do
...
@@ -79,6 +86,13 @@ RSpec.describe Quality::TestLevel do
end
end
end
end
context
'when level is migration'
do
it
'returns a regexp'
do
expect
(
subject
.
regexp
(
:migration
))
.
to
eq
(
%r{spec/(migrations|lib/gitlab/background_migration)}
)
end
end
context
'when level is integration'
do
context
'when level is integration'
do
it
'returns a regexp'
do
it
'returns a regexp'
do
expect
(
subject
.
regexp
(
:integration
))
expect
(
subject
.
regexp
(
:integration
))
...
@@ -116,6 +130,18 @@ RSpec.describe Quality::TestLevel do
...
@@ -116,6 +130,18 @@ RSpec.describe Quality::TestLevel do
expect
(
subject
.
level_for
(
'spec/models/abuse_report_spec.rb'
)).
to
eq
(
:unit
)
expect
(
subject
.
level_for
(
'spec/models/abuse_report_spec.rb'
)).
to
eq
(
:unit
)
end
end
it
'returns the correct level for a migration test'
do
expect
(
subject
.
level_for
(
'spec/migrations/add_default_and_free_plans_spec.rb'
)).
to
eq
(
:migration
)
end
it
'returns the correct level for a background_migration test'
do
expect
(
subject
.
level_for
(
'spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb'
)).
to
eq
(
:migration
)
end
it
'returns the correct level for a geo migration test'
do
expect
(
described_class
.
new
(
'ee/'
).
level_for
(
'ee/spec/migrations/geo/migrate_ci_job_artifacts_to_separate_registry_spec.rb'
)).
to
eq
(
:migration
)
end
it
'returns the correct level for an integration test'
do
it
'returns the correct level for an integration test'
do
expect
(
subject
.
level_for
(
'spec/mailers/abuse_report_mailer_spec.rb'
)).
to
eq
(
:integration
)
expect
(
subject
.
level_for
(
'spec/mailers/abuse_report_mailer_spec.rb'
)).
to
eq
(
:integration
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment