Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoints for health checks #622

Merged
merged 11 commits into from
Apr 11, 2023
6 changes: 6 additions & 0 deletions quetz/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1839,4 +1839,10 @@ def serve_channel_index(
return serve_path("index.html", channel, accept_encoding, session, dao)


@app.get("/health/ready", status_code=status.HTTP_200_OK)
janjagusch marked this conversation as resolved.
Show resolved Hide resolved
@app.get("/health/live", status_code=status.HTTP_200_OK)
def is_ready_live(task: Task = Depends(get_tasks_worker)):
return {}


frontend.register(app)
11 changes: 11 additions & 0 deletions quetz/tests/test_health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from fastapi.testclient import TestClient
janjagusch marked this conversation as resolved.
Show resolved Hide resolved


def test_get_health_ready(client: TestClient):
response = client.get("/health/ready")
assert response.status_code == 200


def test_get_health_live(client: TestClient):
response = client.get("/health/live")
assert response.status_code == 200