Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
g5k-api
Commits
e7f870ec
Commit
e7f870ec
authored
Sep 15, 2021
by
Samir Noir
🧀
Browse files
Add a health action to sites controller to check g5k-api availability
Fixes: bug #13404
parent
739f2e6b
Pipeline
#294581
passed with stages
in 17 minutes and 37 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/sites_controller.rb
View file @
e7f870ec
...
...
@@ -135,6 +135,11 @@ class SitesController < ResourcesController
render_result
(
result
)
end
# Healthcheck of g5k-api, used to check if the app is running.
def
health
render
json:
{
status:
'OK'
}
end
protected
def
collection_path
...
...
config/routes.rb
View file @
e7f870ec
...
...
@@ -52,6 +52,7 @@ Api::Application.routes.draw do
member
do
get
:status
get
:health
end
resources
:network_equipments
,
only:
%i[index show]
...
...
spec/controllers/sites_controller_spec.rb
View file @
e7f870ec
...
...
@@ -265,4 +265,13 @@ describe SitesController do
expect
(
json
[
'version'
]).
to
eq
'f449f0cb61b0cf5adf1ddbae47c9a409af9652f1'
end
end
describe
'GET /sites/{{id}}/health'
do
it
'should get a 200 with a simple JSON'
do
get
:health
,
params:
{
id:
'rennes'
},
format: :json
expect
(
response
.
status
).
to
eq
200
expect
(
json
.
length
).
to
eq
1
expect
(
json
[
'status'
]).
to
eq
'OK'
end
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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