Commit 60ea85f3 authored by Samir Noir's avatar Samir Noir 🧀
Browse files

Add a health action to sites controller to check g5k-api availability

parent 739f2e6b
Pipeline #294580 passed with stages
in 17 minutes and 48 seconds
......@@ -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
......
......@@ -52,6 +52,7 @@ Api::Application.routes.draw do
member do
get :status
get :health
end
resources :network_equipments, only: %i[index show]
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment