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
768d4f55
Commit
768d4f55
authored
Oct 07, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature gate PipelinesController#test_report
parent
226467f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
20 deletions
+43
-20
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+2
-0
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+41
-20
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
768d4f55
...
...
@@ -154,6 +154,8 @@ class Projects::PipelinesController < Projects::ApplicationController
end
def
test_report
return
unless
Feature
.
enabled?
(
:junit_pipeline_view
,
project
)
if
pipeline_test_report
==
:error
render
json:
{
status: :error_parsing_report
}
return
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
768d4f55
...
...
@@ -408,41 +408,62 @@ describe Projects::PipelinesController do
format: :json
end
context
'when pipeline does not have a test report'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
context
'when feature is enabled'
do
before
do
stub_feature_flags
(
junit_pipeline_view:
true
)
end
it
'renders an empty
test report'
do
get_test_report_json
context
'when pipeline does not have a
test report'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'total_count'
]).
to
eq
(
0
)
it
'renders an empty test report'
do
get_test_report_json
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'total_count'
]).
to
eq
(
0
)
end
end
end
context
'when pipeline has a test report'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:with_test_reports
,
project:
project
)
}
context
'when pipeline has a test report'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:with_test_reports
,
project:
project
)
}
it
'renders the test report'
do
get_test_report_json
it
'renders the test report'
do
get_test_report_json
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'total_count'
]).
to
eq
(
4
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'total_count'
]).
to
eq
(
4
)
end
end
context
'when pipeline has corrupt test reports'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
before
do
job
=
create
(
:ci_build
,
pipeline:
pipeline
)
create
(
:ci_job_artifact
,
:junit_with_corrupted_data
,
job:
job
,
project:
project
)
end
it
'renders the test reports'
do
get_test_report_json
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'status'
]).
to
eq
(
'error_parsing_report'
)
end
end
end
context
'when
pipeline has corrupt test reports
'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
context
'when
feature is disabled
'
do
let
(
:pipeline
)
{
create
(
:ci_
empty_
pipeline
,
project:
project
)
}
before
do
job
=
create
(
:ci_build
,
pipeline:
pipeline
)
create
(
:ci_job_artifact
,
:junit_with_corrupted_data
,
job:
job
,
project:
project
)
stub_feature_flags
(
junit_pipeline_view:
false
)
end
it
'renders
the test reports
'
do
it
'renders
empty response
'
do
get_test_report_json
expect
(
response
).
to
have_gitlab_http_status
(
:
ok
)
expect
(
json_response
[
'status'
]).
to
eq
(
'error_parsing_report'
)
expect
(
response
).
to
have_gitlab_http_status
(
:
no_content
)
expect
(
response
.
body
).
to
be_empty
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