Skip to content

Commit

Permalink
Merge pull request #80 from TheJacksonLaboratory/G3-271-health-check-…
Browse files Browse the repository at this point in the history
…response-update

G3 271 health check response update
  • Loading branch information
bergsalex authored Jul 15, 2024
2 parents da0f30e + 5a21d7c commit 4509faf
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "geneweaver-api"
version = "0.7.0a8"
version = "0.7.0a9"
description = "The Geneweaver API"
authors = [
"Alexander Berger <alexander.berger@jax.org>",
Expand All @@ -20,7 +20,7 @@ python = "^3.9"
geneweaver-core = "^0.10.0a3"
fastapi = {extras = ["all"], version = "^0.111.0"}
uvicorn = {extras = ["standard"], version = "^0.30.0"}
geneweaver-db = "0.5.0a12"
geneweaver-db = "0.5.0a13"
psycopg-pool = "^3.1.7"
requests = "^2.32.3"
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
Expand Down
7 changes: 6 additions & 1 deletion src/geneweaver/api/controller/monitors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Endpoints related to system health."""

from datetime import datetime
from typing import Optional

from fastapi import APIRouter, Depends, Query
Expand All @@ -20,7 +21,11 @@ def get_health_check(
] = False,
) -> dict:
"""Return 200 API response if reachable and optionally check db health."""
response = {"status": "UP"}
response = {
"status": "UP",
"details": "All systems normal.",
"datetime": datetime.utcnow(),
}

if db_health_check:
db_health_response = monitors_service.check_db_health(cursor)
Expand Down
2 changes: 1 addition & 1 deletion tests/controllers/test_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def test_valid_url_req(mock_db_heath_service_call, client):
url="/api/monitors/servers/health", params={"db_health_check": True}
)
assert response.status_code == 200
assert response.json() == db_health_status
assert response.json().get("DB_status") == db_health_status.get("DB_status")
2 changes: 2 additions & 0 deletions tests/data/monitors.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"db_health_status": {
"status": "UP",
"details": "All systems normal.",
"datetime": "2024-07-15T18:50:37.318238",
"DB_status": {
"gene_identifier_last_update": {
"gi_date": "2024-06-24T01:54:48.023015+00:00"
Expand Down

0 comments on commit 4509faf

Please sign in to comment.