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
6635c5f0
Commit
6635c5f0
authored
Apr 19, 2019
by
Matija Čupić
Committed by
Kamil Trzciński
Apr 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Metrics feature flag gate
parent
d6d93fe2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
64 deletions
+46
-64
ee/app/controllers/ee/projects/merge_requests_controller.rb
ee/app/controllers/ee/projects/merge_requests_controller.rb
+0
-4
ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+46
-60
No files found.
ee/app/controllers/ee/projects/merge_requests_controller.rb
View file @
6635c5f0
...
...
@@ -43,10 +43,6 @@ module EE
end
def
metrics_reports
unless
::
Feature
.
enabled?
(
:metrics_reports
,
project
)
return
render
json:
''
,
status: :bad_request
end
reports_response
(
merge_request
.
compare_metrics_reports
)
end
...
...
ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
6635c5f0
...
...
@@ -403,6 +403,8 @@ describe Projects::MergeRequestsController do
end
describe
'GET #metrics_reports'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
:with_metrics_reports
,
source_project:
project
,
author:
create
(
:user
))
}
let
(
:params
)
do
{
namespace_id:
project
.
namespace
.
to_param
,
...
...
@@ -413,91 +415,75 @@ describe Projects::MergeRequestsController do
subject
{
get
:metrics_reports
,
params:
params
,
format: :json
}
context
'when feature is enabled'
do
let
(
:merge_request
)
{
create
(
:ee_merge_request
,
:with_metrics_reports
,
source_project:
project
,
author:
create
(
:user
))
}
before
do
allow_any_instance_of
(
::
MergeRequest
).
to
receive
(
:compare_reports
)
.
with
(
::
Ci
::
CompareMetricsReportsService
).
and_return
(
comparison_status
)
end
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
it
'sends polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
to
receive
(
:set_header
)
before
do
allow_any_instance_of
(
::
MergeRequest
).
to
receive
(
:compare_reports
)
.
with
(
::
Ci
::
CompareMetricsReportsService
).
and_return
(
comparison_status
)
end
subject
end
context
'when comparison is being processed'
do
let
(
:comparison_status
)
{
{
status: :parsing
}
}
it
'returns 204 HTTP status
'
do
subject
it
'sends polling interval
'
do
expect
(
::
Gitlab
::
PollingInterval
).
to
receive
(
:set_header
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
subject
end
context
'when comparison is done'
do
let
(
:comparison_status
)
{
{
status: :parsed
,
data:
{
summary:
1
}
}
}
it
'does not send polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
not_to
receive
(
:set_header
)
subject
end
it
'returns 200 HTTP status'
do
subject
it
'returns 204 HTTP status'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
({
'summary'
=>
1
})
end
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
context
'when user created corrupted test reports
'
do
let
(
:comparison_status
)
{
{
status: :error
,
status_reason:
'Failed to parse test reports'
}
}
context
'when comparison is done
'
do
let
(
:comparison_status
)
{
{
status: :parsed
,
data:
{
summary:
1
}
}
}
it
'does not send polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
not_to
receive
(
:set_header
)
it
'does not send polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
not_to
receive
(
:set_header
)
subject
end
subject
end
it
'returns 4
00 HTTP status'
do
subject
it
'returns 2
00 HTTP status'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
).
to
eq
({
'status_reason'
=>
'Failed to parse test reports'
})
end
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
({
'summary'
=>
1
})
end
end
context
'when something went wrong on our system
'
do
let
(
:comparison_status
)
{
{
}
}
context
'when user created corrupted test reports
'
do
let
(
:comparison_status
)
{
{
status: :error
,
status_reason:
'Failed to parse test reports'
}
}
it
'does not send polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
not_to
receive
(
:set_header
)
it
'does not send polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
not_to
receive
(
:set_header
)
subject
end
subject
end
it
'returns 5
00 HTTP status'
do
subject
it
'returns 4
00 HTTP status'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:internal_server_error
)
expect
(
json_response
).
to
eq
({
'status_reason'
=>
'Unknown error'
})
end
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
).
to
eq
({
'status_reason'
=>
'Failed to parse test reports'
})
end
end
context
'when feature is not enabled'
do
before
do
stub_feature_flags
(
metrics_reports:
false
)
context
'when something went wrong on our system'
do
let
(
:comparison_status
)
{
{}
}
it
'does not send polling interval'
do
expect
(
::
Gitlab
::
PollingInterval
).
not_to
receive
(
:set_header
)
subject
end
it
'returns
no content
'
do
it
'returns
500 HTTP status
'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
response
).
to
have_gitlab_http_status
(
:internal_server_error
)
expect
(
json_response
).
to
eq
({
'status_reason'
=>
'Unknown error'
})
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