Skip to content

Commit

Permalink
Merge pull request #19 from PrivateAIM/18-add-healthcheck-endpoint
Browse files Browse the repository at this point in the history
Add healthcheck endpoint
  • Loading branch information
mjugl authored Feb 22, 2024
2 parents 8de419a + 7a0bc99 commit 6e919c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions project/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ async def lifespan(app: FastAPI):

app = FastAPI(lifespan=lifespan)


@app.get("/healthz")
async def do_healthcheck():
return {"status": "ok"}


app.include_router(
upload.router,
prefix="/upload",
Expand Down
5 changes: 5 additions & 0 deletions tests/test_health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_200_healthcheck(test_client):
r = test_client.get("/healthz")

assert r.status_code == 200
assert r.json() == {"status": "ok"}

0 comments on commit 6e919c5

Please sign in to comment.