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
a2504a32
Commit
a2504a32
authored
Oct 05, 2021
by
Andrejs Cunskis
Committed by
Ramya Authappan
Oct 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: attach gitlab version and revision to allure report
parent
a6d3e124
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
25 deletions
+25
-25
qa/Gemfile
qa/Gemfile
+1
-1
qa/Gemfile.lock
qa/Gemfile.lock
+5
-5
qa/qa/runtime/allure_report.rb
qa/qa/runtime/allure_report.rb
+14
-18
qa/spec/specs/allure_report_spec.rb
qa/spec/specs/allure_report_spec.rb
+5
-1
No files found.
qa/Gemfile
View file @
a2504a32
...
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
...
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
gem
'gitlab-qa'
,
require:
'gitlab/qa'
gem
'gitlab-qa'
,
require:
'gitlab/qa'
gem
'activesupport'
,
'~> 6.1.3.2'
# This should stay in sync with the root's Gemfile
gem
'activesupport'
,
'~> 6.1.3.2'
# This should stay in sync with the root's Gemfile
gem
'allure-rspec'
,
'~> 2.1
4.5
'
gem
'allure-rspec'
,
'~> 2.1
5.0
'
gem
'capybara'
,
'~> 3.35.0'
gem
'capybara'
,
'~> 3.35.0'
gem
'capybara-screenshot'
,
'~> 1.0.23'
gem
'capybara-screenshot'
,
'~> 1.0.23'
gem
'rake'
,
'~> 12.3.3'
gem
'rake'
,
'~> 12.3.3'
...
...
qa/Gemfile.lock
View file @
a2504a32
...
@@ -19,10 +19,10 @@ GEM
...
@@ -19,10 +19,10 @@ GEM
rack-test (>= 1.1.0, < 2.0)
rack-test (>= 1.1.0, < 2.0)
rest-client (>= 2.0.2, < 3.0)
rest-client (>= 2.0.2, < 3.0)
rspec (~> 3.8)
rspec (~> 3.8)
allure-rspec (2.1
4.5
)
allure-rspec (2.1
5.0
)
allure-ruby-commons (= 2.1
4.5
)
allure-ruby-commons (= 2.1
5.0
)
rspec-core (>= 3.8, < 4)
rspec-core (>= 3.8, < 4)
allure-ruby-commons (2.1
4.5
)
allure-ruby-commons (2.1
5.0
)
mime-types (>= 3.3, < 4)
mime-types (>= 3.3, < 4)
oj (>= 3.10, < 4)
oj (>= 3.10, < 4)
require_all (>= 2, < 4)
require_all (>= 2, < 4)
...
@@ -136,7 +136,7 @@ GEM
...
@@ -136,7 +136,7 @@ GEM
octokit (4.21.0)
octokit (4.21.0)
faraday (>= 0.9)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
sawyer (~> 0.8.0, >= 0.5.3)
oj (3.13.
2
)
oj (3.13.
8
)
parallel (1.19.2)
parallel (1.19.2)
parallel_tests (2.29.0)
parallel_tests (2.29.0)
parallel
parallel
...
@@ -241,7 +241,7 @@ PLATFORMS
...
@@ -241,7 +241,7 @@ PLATFORMS
DEPENDENCIES
DEPENDENCIES
activesupport (~> 6.1.3.2)
activesupport (~> 6.1.3.2)
airborne (~> 0.3.4)
airborne (~> 0.3.4)
allure-rspec (~> 2.1
4.5
)
allure-rspec (~> 2.1
5.0
)
capybara (~> 3.35.0)
capybara (~> 3.35.0)
capybara-screenshot (~> 1.0.23)
capybara-screenshot (~> 1.0.23)
chemlab (~> 0.9)
chemlab (~> 0.9)
...
...
qa/qa/runtime/allure_report.rb
View file @
a2504a32
...
@@ -5,6 +5,8 @@ require 'active_support/core_ext/enumerable'
...
@@ -5,6 +5,8 @@ require 'active_support/core_ext/enumerable'
module
QA
module
QA
module
Runtime
module
Runtime
class
AllureReport
class
AllureReport
extend
QA
::
Support
::
API
class
<<
self
class
<<
self
# Configure allure reports
# Configure allure reports
#
#
...
@@ -77,27 +79,21 @@ module QA
...
@@ -77,27 +79,21 @@ module QA
end
end
end
end
#
Custom environment info hash
#
Gitlab version and revision information
#
#
# @return [Hash]
# @return [Hash]
def
environment_info
def
environment_info
%w[
lambda
do
CI_COMMIT_SHA
return
{}
unless
Env
.
admin_personal_access_token
||
Env
.
personal_access_token
CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
CI_MERGE_REQUEST_IID
client
=
Env
.
admin_personal_access_token
?
API
::
Client
.
as_admin
:
API
::
Client
.
new
TOP_UPSTREAM_SOURCE_SHA
response
=
get
(
API
::
Request
.
new
(
client
,
'/version'
).
url
)
TOP_UPSTREAM_MERGE_REQUEST_IID
DEPLOY_VERSION
JSON
.
parse
(
response
.
body
,
symbolize_names:
true
)
GITLAB_VERSION
rescue
StandardError
,
ArgumentError
=>
e
GITLAB_SHELL_VERSION
Logger
.
error
(
"Failed to attach version info to allure report:
#{
e
}
"
)
GITLAB_ELASTICSEARCH_INDEXER_VERSION
{}
GITLAB_KAS_VERSION
end
GITLAB_WORKHORSE_VERSION
GITLAB_PAGES_VERSION
GITALY_SERVER_VERSION
QA_IMAGE
QA_BROWSER
]
.
index_with
{
|
val
|
ENV
[
val
]
}.
compact_blank
end
end
end
end
end
end
...
...
qa/spec/specs/allure_report_spec.rb
View file @
a2504a32
...
@@ -45,14 +45,18 @@ describe QA::Runtime::AllureReport do
...
@@ -45,14 +45,18 @@ describe QA::Runtime::AllureReport do
let
(
:png_file
)
{
'png-file'
}
let
(
:png_file
)
{
'png-file'
}
let
(
:html_file
)
{
'html-file'
}
let
(
:html_file
)
{
'html-file'
}
let
(
:ci_job
)
{
'ee:relative 5'
}
let
(
:ci_job
)
{
'ee:relative 5'
}
let
(
:versions
)
{
{
version:
'14'
,
revision:
'6ced31db947'
}
}
before
do
before
do
stub_env
(
'CI'
,
'true'
)
stub_env
(
'CI'
,
'true'
)
stub_env
(
'CI_JOB_NAME'
,
ci_job
)
stub_env
(
'CI_JOB_NAME'
,
ci_job
)
stub_env
(
'GITLAB_QA_ADMIN_ACCESS_TOKEN'
,
'token'
)
allow
(
Allure
).
to
receive
(
:add_attachment
)
allow
(
Allure
).
to
receive
(
:add_attachment
)
allow
(
File
).
to
receive
(
:open
).
with
(
png_path
)
{
png_file
}
allow
(
File
).
to
receive
(
:open
).
with
(
png_path
)
{
png_file
}
allow
(
File
).
to
receive
(
:open
).
with
(
html_path
)
{
html_file
}
allow
(
File
).
to
receive
(
:open
).
with
(
html_path
)
{
html_file
}
allow
(
RestClient
::
Request
).
to
receive
(
:execute
)
{
double
(
'response'
,
code:
200
,
body:
versions
.
to_json
)
}
allow
(
QA
::
Runtime
::
Scenario
).
to
receive
(
:method_missing
).
with
(
:gitlab_address
).
and_return
(
'gitlab.com'
)
described_class
.
configure!
described_class
.
configure!
end
end
...
@@ -61,7 +65,7 @@ describe QA::Runtime::AllureReport do
...
@@ -61,7 +65,7 @@ describe QA::Runtime::AllureReport do
aggregate_failures
do
aggregate_failures
do
expect
(
allure_config
.
results_directory
).
to
eq
(
'tmp/allure-results'
)
expect
(
allure_config
.
results_directory
).
to
eq
(
'tmp/allure-results'
)
expect
(
allure_config
.
clean_results_directory
).
to
eq
(
true
)
expect
(
allure_config
.
clean_results_directory
).
to
eq
(
true
)
expect
(
allure_config
.
environment_properties
).
to
be_a_kind_of
(
Hash
)
expect
(
allure_config
.
environment_properties
.
call
).
to
eq
(
versions
)
expect
(
allure_config
.
environment
).
to
eq
(
'ee:relative'
)
expect
(
allure_config
.
environment
).
to
eq
(
'ee:relative'
)
end
end
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