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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
ad6ac17c
Commit
ad6ac17c
authored
Apr 28, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added rescue block for the test method for the prometheus service
parent
91e8f770
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
changelogs/unreleased/prometheus-integration-test-setting-fix.yml
...gs/unreleased/prometheus-integration-test-setting-fix.yml
+4
-0
lib/gitlab/prometheus.rb
lib/gitlab/prometheus.rb
+5
-1
spec/models/project_services/prometheus_service_spec.rb
spec/models/project_services/prometheus_service_spec.rb
+3
-2
No files found.
changelogs/unreleased/prometheus-integration-test-setting-fix.yml
0 → 100644
View file @
ad6ac17c
---
title
:
Added rescue block for the test method
merge_request
:
10994
author
:
lib/gitlab/prometheus.rb
View file @
ad6ac17c
...
...
@@ -49,7 +49,11 @@ module Gitlab
end
def
get
(
url
)
handle_response
(
HTTParty
.
get
(
url
))
begin
handle_response
(
HTTParty
.
get
(
url
))
rescue
SocketError
raise
PrometheusError
,
"Can't connect to
#{
url
}
"
end
end
def
handle_response
(
response
)
...
...
spec/models/project_services/prometheus_service_spec.rb
View file @
ad6ac17c
...
...
@@ -93,11 +93,12 @@ describe PrometheusService, models: true, caching: true do
[
404
,
500
].
each
do
|
status
|
context
"when Prometheus responds with
#{
status
}
"
do
body_response
=
'QUERY_FAILED'
before
do
stub_all_prometheus_requests
(
environment
.
slug
,
status:
status
,
body:
'QUERY FAILED!'
)
stub_all_prometheus_requests
(
environment
.
slug
,
status:
status
,
body:
body_response
)
end
it
{
is_expected
.
to
eq
(
success:
false
,
result:
%(#{status} -
"QUERY FAILED!
")
)
}
it
{
is_expected
.
to
eq
(
success:
false
,
result:
%(#{status} -
\"#{body_response}\
")
)
}
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