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
46b23dd9
Commit
46b23dd9
authored
Apr 02, 2019
by
rpereira2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all superfluous braces
parent
963e4c8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
app/services/prometheus/proxy_service.rb
app/services/prometheus/proxy_service.rb
+0
-1
spec/services/prometheus/proxy_service_spec.rb
spec/services/prometheus/proxy_service_spec.rb
+11
-11
No files found.
app/services/prometheus/proxy_service.rb
View file @
46b23dd9
...
@@ -61,7 +61,6 @@ module Prometheus
...
@@ -61,7 +61,6 @@ module Prometheus
response
=
prometheus_client_wrapper
.
proxy
(
path
,
params
)
response
=
prometheus_client_wrapper
.
proxy
(
path
,
params
)
success
(
http_status:
response
.
code
,
body:
response
.
body
)
success
(
http_status:
response
.
code
,
body:
response
.
body
)
rescue
Gitlab
::
PrometheusClient
::
Error
=>
err
rescue
Gitlab
::
PrometheusClient
::
Error
=>
err
service_unavailable_response
(
err
)
service_unavailable_response
(
err
)
end
end
...
...
spec/services/prometheus/proxy_service_spec.rb
View file @
46b23dd9
...
@@ -9,7 +9,7 @@ describe Prometheus::ProxyService do
...
@@ -9,7 +9,7 @@ describe Prometheus::ProxyService do
set
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
set
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
describe
'#initialize'
do
describe
'#initialize'
do
let
(
:params
)
{
ActionController
::
Parameters
.
new
(
{
query:
'1'
}
).
permit!
}
let
(
:params
)
{
ActionController
::
Parameters
.
new
(
query:
'1'
).
permit!
}
it
'initializes attributes'
do
it
'initializes attributes'
do
result
=
described_class
.
new
(
environment
,
'GET'
,
'query'
,
{
query:
'1'
})
result
=
described_class
.
new
(
environment
,
'GET'
,
'query'
,
{
query:
'1'
})
...
@@ -17,7 +17,7 @@ describe Prometheus::ProxyService do
...
@@ -17,7 +17,7 @@ describe Prometheus::ProxyService do
expect
(
result
.
prometheus_owner
).
to
eq
(
environment
)
expect
(
result
.
prometheus_owner
).
to
eq
(
environment
)
expect
(
result
.
method
).
to
eq
(
'GET'
)
expect
(
result
.
method
).
to
eq
(
'GET'
)
expect
(
result
.
path
).
to
eq
(
'query'
)
expect
(
result
.
path
).
to
eq
(
'query'
)
expect
(
result
.
params
).
to
eq
(
{
query:
'1'
}
)
expect
(
result
.
params
).
to
eq
(
query:
'1'
)
end
end
it
'converts ActionController::Parameters into hash'
do
it
'converts ActionController::Parameters into hash'
do
...
@@ -38,11 +38,11 @@ describe Prometheus::ProxyService do
...
@@ -38,11 +38,11 @@ describe Prometheus::ProxyService do
end
end
it
'should return error'
do
it
'should return error'
do
expect
(
subject
.
execute
).
to
eq
(
{
expect
(
subject
.
execute
).
to
eq
(
status: :error
,
status: :error
,
message:
'No prometheus server found'
,
message:
'No prometheus server found'
,
http_status: :service_unavailable
http_status: :service_unavailable
}
)
)
end
end
end
end
...
@@ -53,11 +53,11 @@ describe Prometheus::ProxyService do
...
@@ -53,11 +53,11 @@ describe Prometheus::ProxyService do
end
end
it
'should return error'
do
it
'should return error'
do
expect
(
subject
.
execute
).
to
eq
(
{
expect
(
subject
.
execute
).
to
eq
(
status: :error
,
status: :error
,
message:
'No prometheus server found'
,
message:
'No prometheus server found'
,
http_status: :service_unavailable
http_status: :service_unavailable
}
)
)
end
end
end
end
...
@@ -65,10 +65,10 @@ describe Prometheus::ProxyService do
...
@@ -65,10 +65,10 @@ describe Prometheus::ProxyService do
subject
{
described_class
.
new
(
environment
,
'POST'
,
'query'
,
{
query:
'1'
})
}
subject
{
described_class
.
new
(
environment
,
'POST'
,
'query'
,
{
query:
'1'
})
}
it
'returns error'
do
it
'returns error'
do
expect
(
subject
.
execute
).
to
eq
(
{
expect
(
subject
.
execute
).
to
eq
(
message:
'Proxy support for this API is not available currently'
,
message:
'Proxy support for this API is not available currently'
,
status: :error
status: :error
}
)
)
end
end
end
end
...
@@ -159,11 +159,11 @@ describe Prometheus::ProxyService do
...
@@ -159,11 +159,11 @@ describe Prometheus::ProxyService do
end
end
it
'returns error'
do
it
'returns error'
do
expect
(
subject
.
execute
).
to
eq
(
{
expect
(
subject
.
execute
).
to
eq
(
status: :error
,
status: :error
,
message:
'Network connection error'
,
message:
'Network connection error'
,
http_status: :service_unavailable
http_status: :service_unavailable
}
)
)
end
end
end
end
end
end
...
@@ -178,7 +178,7 @@ describe Prometheus::ProxyService do
...
@@ -178,7 +178,7 @@ describe Prometheus::ProxyService do
expect
(
result
.
prometheus_owner
).
to
eq
(
environment
)
expect
(
result
.
prometheus_owner
).
to
eq
(
environment
)
expect
(
result
.
method
).
to
eq
(
'GET'
)
expect
(
result
.
method
).
to
eq
(
'GET'
)
expect
(
result
.
path
).
to
eq
(
'query'
)
expect
(
result
.
path
).
to
eq
(
'query'
)
expect
(
result
.
params
).
to
eq
(
{
query:
'1'
}
)
expect
(
result
.
params
).
to
eq
(
query:
'1'
)
end
end
end
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