From 91165e76c71ab0076023794f4e5e6459ab728505 Mon Sep 17 00:00:00 2001 From: Jacob Williamson Date: Thu, 7 May 2026 10:21:06 +0100 Subject: [PATCH 1/2] Add healthz endpoint --- src/daq_queuing_service/api/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/daq_queuing_service/api/api.py b/src/daq_queuing_service/api/api.py index 3fde18a..50c0b83 100644 --- a/src/daq_queuing_service/api/api.py +++ b/src/daq_queuing_service/api/api.py @@ -7,7 +7,7 @@ UnknownPlanError, ) from blueapi.service.model import TaskRequest -from fastapi import APIRouter, Request +from fastapi import APIRouter, Request, Response from pydantic import BaseModel from daq_queuing_service.task import ExperimentDefinition, Status, Task @@ -71,6 +71,10 @@ def create_api_router( ) -> APIRouter: router = APIRouter() + @router.get("/healthz") + async def healthz(): + return Response() + @router.get("/") def read_root(request: Request): base_url = str(request.base_url) From 4de00b0c262406cf5137ef2f61129dcfef88cb4a Mon Sep 17 00:00:00 2001 From: Jacob Williamson Date: Thu, 7 May 2026 10:24:32 +0100 Subject: [PATCH 2/2] Add test --- tests/unit_tests/test_api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/unit_tests/test_api.py b/tests/unit_tests/test_api.py index f97dc96..63493b5 100644 --- a/tests/unit_tests/test_api.py +++ b/tests/unit_tests/test_api.py @@ -69,6 +69,11 @@ def test_read_root_returns_expected_string(test_client: TestClient): ) +def test_healthz_returns_healthy(test_client: TestClient): + response = test_client.get("/healthz") + assert response.status_code == 200 + + def test_get_queue_state_returns_queue_state(test_client: TestClient): response = test_client.get("/queue/state") assert response.status_code == 200