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
9de23c57
Commit
9de23c57
authored
Apr 15, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
fe2896f6
95bbcf08
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
4 deletions
+65
-4
app/controllers/projects/environments/prometheus_api_controller.rb
...ollers/projects/environments/prometheus_api_controller.rb
+26
-3
changelogs/unreleased/zj-fsck-no-timeout.yml
changelogs/unreleased/zj-fsck-no-timeout.yml
+5
-0
lib/gitlab/gitaly_client/repository_service.rb
lib/gitlab/gitaly_client/repository_service.rb
+1
-1
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
...s/projects/environments/prometheus_api_controller_spec.rb
+33
-0
No files found.
app/controllers/projects/environments/prometheus_api_controller.rb
View file @
9de23c57
...
@@ -7,9 +7,9 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
...
@@ -7,9 +7,9 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
def
proxy
def
proxy
result
=
Prometheus
::
ProxyService
.
new
(
result
=
Prometheus
::
ProxyService
.
new
(
environment
,
environment
,
request
.
method
,
proxy_
method
,
p
arams
[
:proxy_path
]
,
p
roxy_path
,
p
arams
.
permit!
p
roxy_params
).
execute
).
execute
if
result
.
nil?
if
result
.
nil?
...
@@ -31,7 +31,30 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
...
@@ -31,7 +31,30 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
private
private
def
query_context
Gitlab
::
Prometheus
::
QueryVariables
.
call
(
environment
)
end
def
environment
def
environment
@environment
||=
project
.
environments
.
find
(
params
[
:id
])
@environment
||=
project
.
environments
.
find
(
params
[
:id
])
end
end
def
proxy_method
request
.
method
end
def
proxy_path
params
[
:proxy_path
]
end
def
proxy_params
substitute_query_variables
(
params
).
permit!
end
def
substitute_query_variables
(
params
)
query
=
params
[
:query
]
return
params
unless
query
params
.
merge
(
query:
query
%
query_context
)
end
end
end
changelogs/unreleased/zj-fsck-no-timeout.yml
0 → 100644
View file @
9de23c57
---
title
:
Remove deadline for Git fsck
merge_request
:
27299
author
:
type
:
fixed
lib/gitlab/gitaly_client/repository_service.rb
View file @
9de23c57
...
@@ -190,7 +190,7 @@ module Gitlab
...
@@ -190,7 +190,7 @@ module Gitlab
def
fsck
def
fsck
request
=
Gitaly
::
FsckRequest
.
new
(
repository:
@gitaly_repo
)
request
=
Gitaly
::
FsckRequest
.
new
(
repository:
@gitaly_repo
)
response
=
GitalyClient
.
call
(
@storage
,
:repository_service
,
:fsck
,
request
)
response
=
GitalyClient
.
call
(
@storage
,
:repository_service
,
:fsck
,
request
,
timeout:
GitalyClient
.
no_timeout
)
if
response
.
error
.
empty?
if
response
.
error
.
empty?
return
""
,
0
return
""
,
0
...
...
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
View file @
9de23c57
...
@@ -14,6 +14,7 @@ describe Projects::Environments::PrometheusApiController do
...
@@ -14,6 +14,7 @@ describe Projects::Environments::PrometheusApiController do
describe
'GET #proxy'
do
describe
'GET #proxy'
do
let
(
:prometheus_proxy_service
)
{
instance_double
(
Prometheus
::
ProxyService
)
}
let
(
:prometheus_proxy_service
)
{
instance_double
(
Prometheus
::
ProxyService
)
}
let
(
:expected_params
)
do
let
(
:expected_params
)
do
ActionController
::
Parameters
.
new
(
ActionController
::
Parameters
.
new
(
environment_params
(
environment_params
(
...
@@ -47,6 +48,38 @@ describe Projects::Environments::PrometheusApiController do
...
@@ -47,6 +48,38 @@ describe Projects::Environments::PrometheusApiController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
(
prometheus_json_body
)
expect
(
json_response
).
to
eq
(
prometheus_json_body
)
end
end
context
'with format string'
do
before
do
expected_params
[
:query
]
=
%{up{environment="#{environment.slug}"}}
end
it
'replaces variables with values'
do
get
:proxy
,
params:
environment_params
.
merge
(
query:
'up{environment="%{ci_environment_slug}"}'
)
expect
(
Prometheus
::
ProxyService
).
to
have_received
(
:new
)
.
with
(
environment
,
'GET'
,
'query'
,
expected_params
)
end
context
'with nil query'
do
let
(
:params_without_query
)
do
params
=
environment_params
params
.
delete
(
:query
)
params
end
before
do
expected_params
.
delete
(
:query
)
end
it
'does not raise error'
do
get
:proxy
,
params:
params_without_query
expect
(
Prometheus
::
ProxyService
).
to
have_received
(
:new
)
.
with
(
environment
,
'GET'
,
'query'
,
expected_params
)
end
end
end
end
end
context
'with nil result'
do
context
'with nil result'
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