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
1f9caf4b
Commit
1f9caf4b
authored
Aug 11, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict Group CoverageReports#index to coverage data
parent
c283e982
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
14 deletions
+9
-14
ee/app/controllers/groups/analytics/coverage_reports_controller.rb
...ntrollers/groups/analytics/coverage_reports_controller.rb
+3
-7
ee/spec/controllers/groups/analytics/coverage_reports_controller_spec.rb
...lers/groups/analytics/coverage_reports_controller_spec.rb
+6
-7
No files found.
ee/app/controllers/groups/analytics/coverage_reports_controller.rb
View file @
1f9caf4b
...
@@ -4,10 +4,10 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
...
@@ -4,10 +4,10 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
check_feature_flag
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
check_feature_flag
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
REPORT_WINDOW
=
90
.
days
.
freeze
REPORT_WINDOW
=
90
.
days
.
freeze
COVERAGE_PARAM
=
'coverage'
.
freeze
before_action
:load_group
before_action
:load_group
before_action
->
{
check_feature_availability!
(
:group_coverage_reports
)
}
before_action
->
{
check_feature_availability!
(
:group_coverage_reports
)
}
before_action
:validate_param_type!
def
index
def
index
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -28,7 +28,7 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
...
@@ -28,7 +28,7 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
date:
'date'
,
date:
'date'
,
group_name:
'group_name'
,
group_name:
'group_name'
,
project_name:
->
(
record
)
{
record
.
project
.
name
},
project_name:
->
(
record
)
{
record
.
project
.
name
},
param_type
=>
->
(
record
)
{
record
.
data
[
param_type
]
}
COVERAGE_PARAM
=>
->
(
record
)
{
record
.
data
[
COVERAGE_PARAM
]
}
}
}
).
render
).
render
end
end
...
@@ -65,8 +65,4 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
...
@@ -65,8 +65,4 @@ class Groups::Analytics::CoverageReportsController < Groups::Analytics::Applicat
def
allowed_param_types
def
allowed_param_types
Ci
::
DailyBuildGroupReportResult
::
PARAM_TYPES
Ci
::
DailyBuildGroupReportResult
::
PARAM_TYPES
end
end
def
param_type
params
.
require
(
:param_type
)
end
end
end
ee/spec/controllers/groups/analytics/coverage_reports_controller_spec.rb
View file @
1f9caf4b
...
@@ -11,10 +11,9 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
...
@@ -11,10 +11,9 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
let!
(
:first_coverage
)
{
create_daily_coverage
(
'rspec'
,
79.0
,
'2020-03-09'
)
}
let!
(
:first_coverage
)
{
create_daily_coverage
(
'rspec'
,
79.0
,
'2020-03-09'
)
}
let!
(
:last_coverage
)
{
create_daily_coverage
(
'karma'
,
95.0
,
'2020-03-10'
)
}
let!
(
:last_coverage
)
{
create_daily_coverage
(
'karma'
,
95.0
,
'2020-03-10'
)
}
let
(
:
index_request
)
do
let
(
:
valid_request_params
)
do
get
:index
,
params:
{
{
group_id:
group
.
name
,
group_id:
group
.
name
,
param_type:
'coverage'
,
start_date:
'2020-03-01'
,
start_date:
'2020-03-01'
,
end_date:
'2020-03-31'
,
end_date:
'2020-03-31'
,
ref_path:
ref_path
,
ref_path:
ref_path
,
...
@@ -29,7 +28,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
...
@@ -29,7 +28,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
describe
'GET index'
do
describe
'GET index'
do
it
'responds 403'
do
it
'responds 403'
do
index_request
get
:index
,
params:
valid_request_params
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
...
@@ -49,7 +48,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
...
@@ -49,7 +48,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
describe
'GET index'
do
describe
'GET index'
do
it
'responds 403 because the feature is not licensed'
do
it
'responds 403 because the feature is not licensed'
do
index_request
get
:index
,
params:
valid_request_params
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
...
@@ -64,7 +63,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
...
@@ -64,7 +63,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
describe
'GET index'
do
describe
'GET index'
do
it
'responds 403 because the feature is not licensed'
do
it
'responds 403 because the feature is not licensed'
do
index_request
get
:index
,
params:
valid_request_params
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
...
@@ -77,7 +76,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
...
@@ -77,7 +76,7 @@ RSpec.describe Groups::Analytics::CoverageReportsController do
end
end
it
'responds 200 with CSV coverage data'
do
it
'responds 200 with CSV coverage data'
do
index_request
get
:index
,
params:
valid_request_params
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
csv_response
).
to
eq
([
expect
(
csv_response
).
to
eq
([
...
...
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