-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from lsst-dm/tickets/DM-31215
DM-31215: Add health check endpoint to the server
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
from fastapi.testclient import TestClient | ||
|
||
from alertdb.server import create_server | ||
from alertdb.storage import FileBackend | ||
|
||
|
||
@pytest.fixture | ||
def file_backend(tmp_path): | ||
"""Pytest fixture for a file-based backend""" | ||
yield FileBackend(str(tmp_path)) | ||
|
||
|
||
def test_server_healthcheck(file_backend): | ||
"""Test that the server responds on the healthcheck endpoint.""" | ||
server = create_server(file_backend) | ||
client = TestClient(server) | ||
response = client.get("/v1/health") | ||
assert response.status_code == 200 |