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
f7b2740c
Commit
f7b2740c
authored
Apr 30, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expect metric_data key
parent
b9839862
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
7 deletions
+18
-7
ee/app/helpers/ee/environments_helper.rb
ee/app/helpers/ee/environments_helper.rb
+13
-3
ee/spec/support/shared_examples/controllers/cluster_metrics_shared_examples.rb
...d_examples/controllers/cluster_metrics_shared_examples.rb
+1
-1
spec/controllers/concerns/metrics_dashboard_spec.rb
spec/controllers/concerns/metrics_dashboard_spec.rb
+1
-1
spec/controllers/projects/grafana_api_controller_spec.rb
spec/controllers/projects/grafana_api_controller_spec.rb
+2
-1
spec/controllers/projects/prometheus/alerts_controller_spec.rb
...controllers/projects/prometheus/alerts_controller_spec.rb
+1
-1
No files found.
ee/app/helpers/ee/environments_helper.rb
View file @
f7b2740c
...
...
@@ -32,10 +32,20 @@ module EE
override
:project_metrics_data
def
project_metrics_data
(
project
)
ee_
project_
metrics_data
=
{}
ee_
project_
metrics_data
[
'logs_path'
]
=
project_logs_path
(
project
)
if
can?
(
current_user
,
:read_pod_logs
,
project
)
ee_metrics_data
=
{}
ee_metrics_data
[
'logs_path'
]
=
project_logs_path
(
project
)
if
can?
(
current_user
,
:read_pod_logs
,
project
)
super
.
merge
(
ee_project_metrics_data
)
super
.
merge
(
ee_metrics_data
)
end
override
:project_and_environment_metrics_data
def
project_and_environment_metrics_data
(
project
,
environment
)
ee_metrics_data
=
{}
# overwrites project_metrics_data logs_path if environment is available
ee_metrics_data
[
'logs_path'
]
=
project_logs_path
(
project
,
environment_name:
environment
.
name
)
if
can?
(
current_user
,
:read_pod_logs
,
project
)
super
.
merge
(
ee_metrics_data
)
end
end
end
ee/spec/support/shared_examples/controllers/cluster_metrics_shared_examples.rb
View file @
f7b2740c
...
...
@@ -191,7 +191,7 @@ RSpec.shared_examples 'cluster metrics' do
get
:metrics_dashboard
,
params:
metrics_params
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
keys
).
to
contain_exactly
(
'dashboard'
,
'status'
)
expect
(
json_response
.
keys
).
to
contain_exactly
(
'dashboard'
,
'status'
,
'metrics_data'
)
end
it
'is the default dashboard'
do
...
...
spec/controllers/concerns/metrics_dashboard_spec.rb
View file @
f7b2740c
...
...
@@ -54,7 +54,7 @@ describe MetricsDashboard do
it
'returns the specified dashboard'
do
expect
(
json_response
[
'dashboard'
][
'dashboard'
]).
to
eq
(
'Environment metrics'
)
expect
(
json_response
).
not_to
have_key
(
'all_dashboards'
)
expect
(
json_response
).
not_
to
have_key
(
'metrics_data'
)
expect
(
json_response
).
to
have_key
(
'metrics_data'
)
end
end
...
...
spec/controllers/projects/grafana_api_controller_spec.rb
View file @
f7b2740c
...
...
@@ -131,10 +131,11 @@ describe Projects::GrafanaApiController do
get
:metrics_dashboard
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
({
expect
(
json_response
).
to
include
({
'dashboard'
=>
'{}'
,
'status'
=>
'success'
})
expect
(
json_response
).
to
include
(
'metrics_data'
)
end
end
...
...
spec/controllers/projects/prometheus/alerts_controller_spec.rb
View file @
f7b2740c
...
...
@@ -352,7 +352,7 @@ describe Projects::Prometheus::AlertsController do
get
:metrics_dashboard
,
params:
request_params
(
id:
metric
.
id
,
environment_id:
alert
.
environment
.
id
),
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
keys
).
to
contain_exactly
(
'dashboard'
,
'status'
)
expect
(
json_response
.
keys
).
to
contain_exactly
(
'dashboard'
,
'status'
,
'metrics_data'
)
end
it
'is the correct embed'
do
...
...
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