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
c0a66dbd
Commit
c0a66dbd
authored
Jun 06, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix prometheus service tests
parent
336cef43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
spec/models/project_services/prometheus_service_spec.rb
spec/models/project_services/prometheus_service_spec.rb
+3
-2
spec/support/prometheus_helpers.rb
spec/support/prometheus_helpers.rb
+13
-0
No files found.
spec/models/project_services/prometheus_service_spec.rb
View file @
c0a66dbd
...
...
@@ -61,7 +61,7 @@ describe PrometheusService, models: true, caching: true do
end
it
'returns reactive data'
do
is_expected
.
to
eq
(
prometheus_data
)
is_expected
.
to
eq
(
prometheus_
metrics_
data
)
end
end
end
...
...
@@ -82,7 +82,7 @@ describe PrometheusService, models: true, caching: true do
end
it
'returns reactive data'
do
is_expected
.
to
eq
(
prometheus_data
.
merge
(
deployment_time:
deployment
.
created_at
.
to_i
))
is_expected
.
to
eq
(
prometheus_
metrics_
data
.
merge
(
deployment_time:
deployment
.
created_at
.
to_i
))
end
end
end
...
...
@@ -112,6 +112,7 @@ describe PrometheusService, models: true, caching: true do
end
it
{
expect
(
subject
.
to_json
).
to
eq
(
prometheus_data
.
to_json
)
}
it
{
expect
(
subject
.
to_json
).
to
eq
(
prometheus_data
.
to_json
)
}
end
[
404
,
500
].
each
do
|
status
|
...
...
spec/support/prometheus_helpers.rb
View file @
c0a66dbd
...
...
@@ -96,6 +96,19 @@ module PrometheusHelpers
end
def
prometheus_data
(
last_update:
Time
.
now
.
utc
)
{
success:
true
,
data:
{
memory_values:
prometheus_values_body
(
'matrix'
).
dig
(
:data
,
:result
),
memory_current:
prometheus_value_body
(
'vector'
).
dig
(
:data
,
:result
),
cpu_values:
prometheus_values_body
(
'matrix'
).
dig
(
:data
,
:result
),
cpu_current:
prometheus_value_body
(
'vector'
).
dig
(
:data
,
:result
)
},
last_update:
last_update
}
end
def
prometheus_metrics_data
(
last_update:
Time
.
now
.
utc
)
{
success:
true
,
metrics:
{
...
...
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