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
4be83b5b
Commit
4be83b5b
authored
Dec 02, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Detect relevant tests using test mapping"
This reverts commit
ddfe65bb
.
parent
4527bca5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
34 deletions
+21
-34
.gitlab/ci/rails.gitlab-ci.yml
.gitlab/ci/rails.gitlab-ci.yml
+2
-2
.gitlab/ci/setup.gitlab-ci.yml
.gitlab/ci/setup.gitlab-ci.yml
+3
-5
scripts/rspec_helpers.sh
scripts/rspec_helpers.sh
+12
-18
scripts/utils.sh
scripts/utils.sh
+1
-1
tooling/bin/find_foss_tests
tooling/bin/find_foss_tests
+3
-8
No files found.
.gitlab/ci/rails.gitlab-ci.yml
View file @
4be83b5b
...
...
@@ -22,7 +22,7 @@
RUBY_GC_MALLOC_LIMIT_MAX
:
134217728
CRYSTALBALL
:
"
true"
RECORD_DEPRECATIONS
:
"
true"
needs
:
[
"
setup-test-env"
,
"
retrieve-tests-metadata"
,
"
compile-test-assets"
,
"
detect-tests"
]
needs
:
[
"
setup-test-env"
,
"
retrieve-tests-metadata"
,
"
compile-test-assets"
]
script
:
-
*base-script
-
rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag ~level:migration"
...
...
@@ -64,7 +64,7 @@
-
.rspec-base
-
.as-if-foss
-
.use-pg11
needs
:
[
"
setup-test-env"
,
"
retrieve-tests-metadata"
,
"
compile-test-assets
as-if-foss"
,
"
detect-tests"
]
needs
:
[
"
setup-test-env"
,
"
retrieve-tests-metadata"
,
"
compile-test-assets
as-if-foss"
]
.rspec-ee-base-pg11
:
extends
:
...
...
.gitlab/ci/setup.gitlab-ci.yml
View file @
4be83b5b
...
...
@@ -61,16 +61,14 @@ verify-tests-yml:
-
scripts/verify-tff-mapping
.detect-test-base
:
image
:
ruby:2.7
image
:
ruby:2.7
-alpine
needs
:
[]
stage
:
prepare
script
:
-
source ./scripts/utils.sh
-
source ./scripts/rspec_helpers.sh
-
source scripts/utils.sh
-
install_gitlab_gem
-
install_tff_gem
-
retrieve_tests_mapping
-
tooling/bin/find_tests ${MATCHED_TESTS_FILE}
-
tooling/bin/find_foss_tests ${MATCHED_TESTS_FILE}
-
'
echo
"test
files
affected:
$(cat
$MATCHED_TESTS_FILE)"'
artifacts
:
expire_in
:
7d
...
...
scripts/rspec_helpers.sh
View file @
4be83b5b
#!/usr/bin/env bash
function
retrieve_tests_metadata
()
{
mkdir
-p
knapsack/ rspec_flaky/ rspec_profiling/
mkdir
-p
crystalball/
knapsack/ rspec_flaky/ rspec_profiling/
local
project_path
=
"gitlab-org/gitlab"
local
test_metadata_job_id
...
...
@@ -16,6 +16,15 @@ function retrieve_tests_metadata() {
if
[[
!
-f
"
${
FLAKY_RSPEC_SUITE_REPORT_PATH
}
"
]]
;
then
scripts/api/download_job_artifact
--project
"
${
project_path
}
"
--job-id
"
${
test_metadata_job_id
}
"
--artifact-path
"
${
FLAKY_RSPEC_SUITE_REPORT_PATH
}
"
||
echo
"{}"
>
"
${
FLAKY_RSPEC_SUITE_REPORT_PATH
}
"
fi
local
test_metadata_with_mapping_job_id
test_metadata_with_mapping_job_id
=
$(
scripts/api/get_job_id
--project
"
${
project_path
}
"
-q
"status=success"
-q
"ref=master"
-q
"username=gitlab-bot"
-Q
"scope=success"
--job-name
"update-tests-metadata"
--artifact-path
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
.gz"
)
if
[[
!
-f
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
"
]]
;
then
(
scripts/api/download_job_artifact
--project
"
${
project_path
}
"
--job-id
"
${
test_metadata_job_id
}
"
--artifact-path
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
.gz"
&&
gzip
-d
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
.gz"
)
||
echo
"{}"
>
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
"
fi
scripts/unpack-test-mapping
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
"
"
${
RSPEC_TESTS_MAPPING_PATH
}
"
}
function
update_tests_metadata
()
{
...
...
@@ -36,21 +45,6 @@ function update_tests_metadata() {
fi
}
function
retrieve_tests_mapping
()
{
mkdir
-p
crystalball/
local
project_path
=
"gitlab-org/gitlab"
local
test_metadata_with_mapping_job_id
test_metadata_with_mapping_job_id
=
$(
scripts/api/get_job_id
--project
"
${
project_path
}
"
-q
"status=success"
-q
"ref=master"
-q
"username=gitlab-bot"
-Q
"scope=success"
--job-name
"update-tests-metadata"
--artifact-path
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
.gz"
)
if
[[
!
-f
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
"
]]
;
then
(
scripts/api/download_job_artifact
--project
"
${
project_path
}
"
--job-id
"
${
test_metadata_with_mapping_job_id
}
"
--artifact-path
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
.gz"
&&
gzip
-d
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
.gz"
)
||
echo
"{}"
>
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
"
fi
scripts/unpack-test-mapping
"
${
RSPEC_PACKED_TESTS_MAPPING_PATH
}
"
"
${
RSPEC_TESTS_MAPPING_PATH
}
"
}
function
update_tests_mapping
()
{
if
!
crystalball_rspec_data_exists
;
then
echo
"No crystalball rspec data found."
...
...
@@ -127,8 +121,8 @@ function rspec_paralellized_job() {
local
rspec_args
=
"-Ispec -rspec_helper --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml
${
rspec_opts
}
"
if
[[
-n
$RSPEC_
TESTS_MAPPING
_ENABLED
]]
;
then
tooling/bin/parallel_rspec
--rspec_args
"
${
rspec_args
}
"
--filter
"tmp/matching_tests.txt"
if
[[
-n
$RSPEC_
MATCHING_TESTS
_ENABLED
]]
;
then
tooling/bin/parallel_rspec
--rspec_args
"
${
rspec_args
}
"
--filter
tmp/matching_tests.txt
else
tooling/bin/parallel_rspec
--rspec_args
"
${
rspec_args
}
"
fi
...
...
scripts/utils.sh
View file @
4be83b5b
...
...
@@ -36,7 +36,7 @@ function install_gitlab_gem() {
}
function
install_tff_gem
()
{
gem
install
test_file_finder
--version
0.1.
1
gem
install
test_file_finder
--version
0.1.
0
}
function
run_timed_command
()
{
...
...
tooling/bin/find_tests
→
tooling/bin/find_
foss_
tests
View file @
4be83b5b
...
...
@@ -19,12 +19,7 @@ mr_iid = ENV.fetch('CI_MERGE_REQUEST_IID')
mr_changes
=
Gitlab
.
merge_request_changes
(
mr_project_path
,
mr_iid
)
changed_files
=
mr_changes
.
changes
.
map
{
|
change
|
change
[
'new_path'
]
}
tff
=
TestFileFinder
::
FileFinder
.
new
(
paths:
changed_files
).
tap
do
|
file_finder
|
file_finder
.
use
TestFileFinder
::
MappingStrategies
::
PatternMatching
.
load
(
'tests.yml'
)
mapping
=
TestFileFinder
::
Mapping
.
load
(
'tests.yml'
)
test_files
=
TestFileFinder
::
FileFinder
.
new
(
paths:
changed_files
,
mapping:
mapping
).
test_files
if
ENV
[
'RSPEC_TESTS_MAPPING_ENABLED'
]
file_finder
.
use
TestFileFinder
::
MappingStrategies
::
DirectMatching
.
load_json
(
ENV
[
'RSPEC_TESTS_MAPPING_PATH'
])
end
end
File
.
write
(
output_file
,
tff
.
test_files
.
uniq
.
join
(
' '
))
File
.
write
(
output_file
,
test_files
.
uniq
.
join
(
' '
))
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