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
da1f404f
Commit
da1f404f
authored
Sep 30, 2021
by
Andrejs Cunskis
Committed by
Ramya Authappan
Sep 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: Add devops stage tag to exported test metrics
parent
0335e0c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
qa/qa/support/formatters/test_stats_formatter.rb
qa/qa/support/formatters/test_stats_formatter.rb
+13
-2
qa/spec/support/formatters/test_stats_formatter_spec.rb
qa/spec/support/formatters/test_stats_formatter_spec.rb
+8
-3
No files found.
qa/qa/support/formatters/test_stats_formatter.rb
View file @
da1f404f
...
...
@@ -57,19 +57,22 @@ module QA
# @param [RSpec::Core::Example] example
# @return [Hash]
def
test_stats
(
example
)
file_path
=
example
.
metadata
[
:file_path
].
gsub
(
'./qa/specs/features'
,
''
)
{
name:
'test-stats'
,
time:
time
,
tags:
{
name:
example
.
full_description
,
file_path:
example
.
metadata
[
:file_path
].
gsub
(
'./qa/specs/features'
,
''
)
,
file_path:
file_path
,
status:
example
.
execution_result
.
status
,
reliable:
example
.
metadata
.
key?
(
:reliable
).
to_s
,
quarantined:
example
.
metadata
.
key?
(
:quarantine
).
to_s
,
retried:
((
example
.
metadata
[
:retry_attempts
]
||
0
)
>
0
).
to_s
,
job_name:
job_name
,
merge_request:
merge_request
,
run_type:
env
(
'QA_RUN_TYPE'
)
||
run_type
run_type:
env
(
'QA_RUN_TYPE'
)
||
run_type
,
stage:
devops_stage
(
file_path
)
},
fields:
{
id:
example
.
id
,
...
...
@@ -150,6 +153,14 @@ module QA
ENV
[
name
]
end
# Get spec devops stage
#
# @param [String] location
# @return [String, nil]
def
devops_stage
(
file_path
)
file_path
.
match
(
%r{(
\d
{1,2}_
\w
+)/}
)
&
.
captures
&
.
first
end
end
end
end
...
...
qa/spec/support/formatters/test_stats_formatter_spec.rb
View file @
da1f404f
...
...
@@ -18,6 +18,8 @@ describe QA::Support::Formatters::TestStatsFormatter do
let
(
:quarantined
)
{
'false'
}
let
(
:influx_client
)
{
instance_double
(
'InfluxDB2::Client'
,
create_write_api:
influx_write_api
)
}
let
(
:influx_write_api
)
{
instance_double
(
'InfluxDB2::WriteApi'
,
write:
nil
)
}
let
(
:stage
)
{
'1_manage'
}
let
(
:file_path
)
{
"./qa/specs/features/
#{
stage
}
/subfolder/some_spec.rb"
}
let
(
:influx_client_args
)
do
{
...
...
@@ -34,14 +36,15 @@ describe QA::Support::Formatters::TestStatsFormatter do
time:
DateTime
.
strptime
(
ci_timestamp
).
to_time
,
tags:
{
name:
'stats export spec'
,
file_path:
'./spec/support/formatters/test_stats_formatter_spec.rb'
,
file_path:
file_path
.
gsub
(
'./qa/specs/features'
,
''
)
,
status: :passed
,
reliable:
reliable
,
quarantined:
quarantined
,
retried:
"false"
,
job_name:
"test-job"
,
merge_request:
"false"
,
run_type:
run_type
run_type:
run_type
,
stage:
stage
},
fields:
{
id:
'./spec/support/formatters/test_stats_formatter_spec.rb[1:1]'
,
...
...
@@ -57,7 +60,9 @@ describe QA::Support::Formatters::TestStatsFormatter do
def
run_spec
(
&
spec
)
spec
||=
->
{
it
(
'spec'
)
{}
}
describe_successfully
(
'stats export'
,
&
spec
)
describe_successfully
(
'stats export'
,
&
spec
).
tap
do
|
example_group
|
example_group
.
examples
.
each
{
|
ex
|
ex
.
metadata
[
:file_path
]
=
file_path
}
end
send_stop_notification
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