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
992409c3
Commit
992409c3
authored
Sep 30, 2021
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'allow-test-level-to-take-several-prefixes' into 'master'"
This reverts merge request !71308
parent
be348ffe
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
41 additions
and
55 deletions
+41
-55
.gitlab/ci/frontend.gitlab-ci.yml
.gitlab/ci/frontend.gitlab-ci.yml
+17
-7
.gitlab/ci/rules.gitlab-ci.yml
.gitlab/ci/rules.gitlab-ci.yml
+7
-0
.gitlab/ci/test-metadata.gitlab-ci.yml
.gitlab/ci/test-metadata.gitlab-ci.yml
+2
-1
doc/development/pipelines.md
doc/development/pipelines.md
+4
-4
scripts/rspec_helpers.sh
scripts/rspec_helpers.sh
+4
-8
spec/tooling/quality/test_level_spec.rb
spec/tooling/quality/test_level_spec.rb
+2
-16
tooling/quality/test_level.rb
tooling/quality/test_level.rb
+5
-19
No files found.
.gitlab/ci/frontend.gitlab-ci.yml
View file @
992409c3
...
@@ -128,13 +128,11 @@ update-storybook-yarn-cache:
...
@@ -128,13 +128,11 @@ update-storybook-yarn-cache:
-
tmp/tests/frontend/
-
tmp/tests/frontend/
-
knapsack/
-
knapsack/
# In gitlab-foss, generates FOSS fixtures. In gitlab, generates FOSS & EE fixtures.
rspec frontend_fixture
:
# That way, we don't need to have two separate jobs.
rspec-all frontend_fixture
:
extends
:
extends
:
-
.frontend-fixtures-base
-
.frontend-fixtures-base
-
.frontend:rules:default-frontend-jobs
-
.frontend:rules:default-frontend-jobs
parallel
:
5
parallel
:
2
rspec frontend_fixture as-if-foss
:
rspec frontend_fixture as-if-foss
:
extends
:
extends
:
...
@@ -142,6 +140,12 @@ rspec frontend_fixture as-if-foss:
...
@@ -142,6 +140,12 @@ rspec frontend_fixture as-if-foss:
-
.frontend:rules:default-frontend-jobs-as-if-foss
-
.frontend:rules:default-frontend-jobs-as-if-foss
-
.as-if-foss
-
.as-if-foss
rspec-ee frontend_fixture
:
extends
:
-
.frontend-fixtures-base
-
.frontend:rules:default-frontend-jobs-ee
parallel
:
3
graphql-schema-dump
:
graphql-schema-dump
:
variables
:
variables
:
SETUP_DB
:
"
false"
SETUP_DB
:
"
false"
...
@@ -192,7 +196,9 @@ jest:
...
@@ -192,7 +196,9 @@ jest:
-
.frontend:rules:jest
-
.frontend:rules:jest
needs
:
needs
:
-
job
:
"
detect-tests"
-
job
:
"
detect-tests"
-
job
:
"
rspec-all
frontend_fixture"
-
job
:
"
rspec
frontend_fixture"
-
job
:
"
rspec-ee
frontend_fixture"
optional
:
true
artifacts
:
artifacts
:
name
:
coverage-frontend
name
:
coverage-frontend
expire_in
:
31d
expire_in
:
31d
...
@@ -219,7 +225,9 @@ jest-integration:
...
@@ -219,7 +225,9 @@ jest-integration:
script
:
script
:
-
run_timed_command "yarn jest:integration --ci"
-
run_timed_command "yarn jest:integration --ci"
needs
:
needs
:
-
job
:
"
rspec-all
frontend_fixture"
-
job
:
"
rspec
frontend_fixture"
-
job
:
"
rspec-ee
frontend_fixture"
optional
:
true
-
job
:
"
graphql-schema-dump"
-
job
:
"
graphql-schema-dump"
jest-as-if-foss
:
jest-as-if-foss
:
...
@@ -333,7 +341,9 @@ startup-css-check:
...
@@ -333,7 +341,9 @@ startup-css-check:
-
.frontend:rules:default-frontend-jobs
-
.frontend:rules:default-frontend-jobs
needs
:
needs
:
-
job
:
"
compile-test-assets"
-
job
:
"
compile-test-assets"
-
job
:
"
rspec-all
frontend_fixture"
-
job
:
"
rspec
frontend_fixture"
-
job
:
"
rspec-ee
frontend_fixture"
optional
:
true
startup-css-check as-if-foss
:
startup-css-check as-if-foss
:
extends
:
extends
:
...
...
.gitlab/ci/rules.gitlab-ci.yml
View file @
992409c3
...
@@ -495,6 +495,13 @@
...
@@ -495,6 +495,13 @@
-
<<
:
*if-default-refs
-
<<
:
*if-default-refs
changes
:
*code-backstage-patterns
changes
:
*code-backstage-patterns
.frontend:rules:default-frontend-jobs-ee:
rules
:
-
<<
:
*if-not-ee
when
:
never
-
<<
:
*if-default-refs
changes
:
*code-backstage-patterns
.frontend:rules:default-frontend-jobs-as-if-foss:
.frontend:rules:default-frontend-jobs-as-if-foss:
rules
:
rules
:
-
<<
:
*if-not-ee
-
<<
:
*if-not-ee
...
...
.gitlab/ci/test-metadata.gitlab-ci.yml
View file @
992409c3
...
@@ -29,7 +29,8 @@ update-tests-metadata:
...
@@ -29,7 +29,8 @@ update-tests-metadata:
-
retrieve-tests-metadata
-
retrieve-tests-metadata
-
setup-test-env
-
setup-test-env
-
rspec migration pg12
-
rspec migration pg12
-
rspec-all frontend_fixture
-
rspec frontend_fixture
-
rspec-ee frontend_fixture
-
rspec unit pg12
-
rspec unit pg12
-
rspec integration pg12
-
rspec integration pg12
-
rspec system pg12
-
rspec system pg12
...
...
doc/development/pipelines.md
View file @
992409c3
...
@@ -252,7 +252,7 @@ graph RL;
...
@@ -252,7 +252,7 @@ graph RL;
2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6;
2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6;
end
end
2_2-2["rspec
-all
frontend_fixture (7 minutes)"];
2_2-2["rspec
frontend_fixture/rspec-ee
frontend_fixture (7 minutes)"];
class 2_2-2 criticalPath;
class 2_2-2 criticalPath;
click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0"
click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0"
2_2-4["memory-on-boot (3.5 minutes)"];
2_2-4["memory-on-boot (3.5 minutes)"];
...
@@ -284,7 +284,7 @@ graph RL;
...
@@ -284,7 +284,7 @@ graph RL;
3_1-1["jest (14.5 minutes)"];
3_1-1["jest (14.5 minutes)"];
class 3_1-1 criticalPath;
class 3_1-1 criticalPath;
click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0"
click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0"
subgraph "Needs `rspec
-all
frontend_fixture`";
subgraph "Needs `rspec
frontend_fixture/rspec-ee
frontend_fixture`";
3_1-1 --> 2_2-2;
3_1-1 --> 2_2-2;
end
end
...
@@ -355,7 +355,7 @@ graph RL;
...
@@ -355,7 +355,7 @@ graph RL;
2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6;
2_1-1 & 2_1-2 & 2_1-3 & 2_1-4 --> 1-6;
end
end
2_2-2["rspec
-all
frontend_fixture (7 minutes)"];
2_2-2["rspec
frontend_fixture/rspec-ee
frontend_fixture (7 minutes)"];
class 2_2-2 criticalPath;
class 2_2-2 criticalPath;
click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0"
click 2_2-2 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=7910143&udv=0"
2_2-4["memory-on-boot (3.5 minutes)"];
2_2-4["memory-on-boot (3.5 minutes)"];
...
@@ -395,7 +395,7 @@ graph RL;
...
@@ -395,7 +395,7 @@ graph RL;
3_1-1["jest (14.5 minutes)"];
3_1-1["jest (14.5 minutes)"];
class 3_1-1 criticalPath;
class 3_1-1 criticalPath;
click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0"
click 3_1-1 "https://app.periscopedata.com/app/gitlab/652085/Engineering-Productivity---Pipeline-Build-Durations?widget=6914204&udv=0"
subgraph "Needs `rspec
-all
frontend_fixture`";
subgraph "Needs `rspec
frontend_fixture/rspec-ee
frontend_fixture`";
3_1-1 --> 2_2-2;
3_1-1 --> 2_2-2;
end
end
...
...
scripts/rspec_helpers.sh
View file @
992409c3
...
@@ -109,18 +109,14 @@ function rspec_paralellized_job() {
...
@@ -109,18 +109,14 @@ function rspec_paralellized_job() {
local
test_level
=
"
${
job_name
[1]
}
"
local
test_level
=
"
${
job_name
[1]
}
"
local
report_name
=
$(
echo
"
${
CI_JOB_NAME
}
"
|
sed
-E
's|[/ ]|_|g'
)
# e.g. 'rspec unit pg12 1/24' would become 'rspec_unit_pg12_1_24'
local
report_name
=
$(
echo
"
${
CI_JOB_NAME
}
"
|
sed
-E
's|[/ ]|_|g'
)
# e.g. 'rspec unit pg12 1/24' would become 'rspec_unit_pg12_1_24'
local
rspec_opts
=
"
${
1
}
"
local
rspec_opts
=
"
${
1
}
"
local
spec_folder_prefix
es
=
""
local
spec_folder_prefix
=
""
if
[[
"
${
test_tool
}
"
=
~
"-ee"
]]
;
then
if
[[
"
${
test_tool
}
"
=
~
"-ee"
]]
;
then
spec_folder_prefix
es
=
"'ee/'
"
spec_folder_prefix
=
"ee/
"
fi
fi
if
[[
"
${
test_tool
}
"
=
~
"-jh"
]]
;
then
if
[[
"
${
test_tool
}
"
=
~
"-jh"
]]
;
then
spec_folder_prefixes
=
"'jh/'"
spec_folder_prefix
=
"jh/"
fi
if
[[
"
${
test_tool
}
"
=
~
"-all"
]]
;
then
spec_folder_prefixes
=
"['', 'ee/']"
fi
fi
export
KNAPSACK_LOG_LEVEL
=
"debug"
export
KNAPSACK_LOG_LEVEL
=
"debug"
...
@@ -135,7 +131,7 @@ function rspec_paralellized_job() {
...
@@ -135,7 +131,7 @@ function rspec_paralellized_job() {
cp
"
${
KNAPSACK_RSPEC_SUITE_REPORT_PATH
}
"
"
${
KNAPSACK_REPORT_PATH
}
"
cp
"
${
KNAPSACK_RSPEC_SUITE_REPORT_PATH
}
"
"
${
KNAPSACK_REPORT_PATH
}
"
if
[[
-z
"
${
KNAPSACK_TEST_FILE_PATTERN
}
"
]]
;
then
if
[[
-z
"
${
KNAPSACK_TEST_FILE_PATTERN
}
"
]]
;
then
pattern
=
$(
ruby
-r
./tooling/quality/test_level.rb
-e
"puts Quality::TestLevel.new(
${
spec_folder_prefixes
}
).pattern(:
${
test_level
}
)"
)
pattern
=
$(
ruby
-r
./tooling/quality/test_level.rb
-e
"puts Quality::TestLevel.new(
%(
${
spec_folder_prefix
}
)
).pattern(:
${
test_level
}
)"
)
export
KNAPSACK_TEST_FILE_PATTERN
=
"
${
pattern
}
"
export
KNAPSACK_TEST_FILE_PATTERN
=
"
${
pattern
}
"
fi
fi
...
...
spec/tooling/quality/test_level_spec.rb
View file @
992409c3
...
@@ -63,14 +63,7 @@ RSpec.describe Quality::TestLevel do
...
@@ -63,14 +63,7 @@ RSpec.describe Quality::TestLevel do
context
'with a prefix'
do
context
'with a prefix'
do
it
'returns a pattern'
do
it
'returns a pattern'
do
expect
(
described_class
.
new
(
'ee/'
).
pattern
(
:system
))
expect
(
described_class
.
new
(
'ee/'
).
pattern
(
:system
))
.
to
eq
(
"{ee/}spec/{features}{,/**/}*_spec.rb"
)
.
to
eq
(
"ee/spec/{features}{,/**/}*_spec.rb"
)
end
end
context
'with several prefixes'
do
it
'returns a pattern'
do
expect
(
described_class
.
new
([
''
,
'ee/'
,
'jh/'
]).
pattern
(
:system
))
.
to
eq
(
"{,ee/,jh/}spec/{features}{,/**/}*_spec.rb"
)
end
end
end
end
...
@@ -145,14 +138,7 @@ RSpec.describe Quality::TestLevel do
...
@@ -145,14 +138,7 @@ RSpec.describe Quality::TestLevel do
context
'with a prefix'
do
context
'with a prefix'
do
it
'returns a regexp'
do
it
'returns a regexp'
do
expect
(
described_class
.
new
(
'ee/'
).
regexp
(
:system
))
expect
(
described_class
.
new
(
'ee/'
).
regexp
(
:system
))
.
to
eq
(
%r{(ee/)spec/(features)}
)
.
to
eq
(
%r{ee/spec/(features)}
)
end
end
context
'with several prefixes'
do
it
'returns a regexp'
do
expect
(
described_class
.
new
([
''
,
'ee/'
,
'jh/'
]).
regexp
(
:system
))
.
to
eq
(
%r{(|ee/|jh/)spec/(features)}
)
end
end
end
end
...
...
tooling/quality/test_level.rb
View file @
992409c3
...
@@ -60,20 +60,20 @@ module Quality
...
@@ -60,20 +60,20 @@ module Quality
system:
[
'features'
]
system:
[
'features'
]
}.
freeze
}.
freeze
attr_reader
:prefix
es
attr_reader
:prefix
def
initialize
(
prefix
es
=
nil
)
def
initialize
(
prefix
=
nil
)
@prefix
es
=
Array
(
prefixes
)
@prefix
=
prefix
@patterns
=
{}
@patterns
=
{}
@regexps
=
{}
@regexps
=
{}
end
end
def
pattern
(
level
)
def
pattern
(
level
)
@patterns
[
level
]
||=
"
#{
prefix
es_for_pattern
}
spec/
#{
folders_pattern
(
level
)
}
{,/**/}*
#{
suffix
(
level
)
}
"
@patterns
[
level
]
||=
"
#{
prefix
}
spec/
#{
folders_pattern
(
level
)
}
{,/**/}*
#{
suffix
(
level
)
}
"
end
end
def
regexp
(
level
)
def
regexp
(
level
)
@regexps
[
level
]
||=
Regexp
.
new
(
"
#{
prefix
es_for_regex
}
spec/
#{
folders_regex
(
level
)
}
"
).
freeze
@regexps
[
level
]
||=
Regexp
.
new
(
"
#{
prefix
}
spec/
#{
folders_regex
(
level
)
}
"
).
freeze
end
end
def
level_for
(
file_path
)
def
level_for
(
file_path
)
...
@@ -102,20 +102,6 @@ module Quality
...
@@ -102,20 +102,6 @@ module Quality
private
private
def
prefixes_for_pattern
return
''
if
prefixes
.
empty?
"{
#{
prefixes
.
join
(
','
)
}
}"
end
def
prefixes_for_regex
return
''
if
prefixes
.
empty?
regex_prefix
=
prefixes
.
map
(
&
Regexp
.
method
(
:escape
)).
join
(
'|'
)
"(
#{
regex_prefix
}
)"
end
def
suffix
(
level
)
def
suffix
(
level
)
case
level
case
level
when
:frontend_fixture
when
:frontend_fixture
...
...
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