Skip to content

Split liveness and readiness health checks#382

Open
silentgeckoaudit3801 wants to merge 2 commits into
Quantarq:mainfrom
silentgeckoaudit3801:ops/split-health-readyz-224
Open

Split liveness and readiness health checks#382
silentgeckoaudit3801 wants to merge 2 commits into
Quantarq:mainfrom
silentgeckoaudit3801:ops/split-health-readyz-224

Conversation

@silentgeckoaudit3801

Copy link
Copy Markdown

Closes #224

Summary

  • add /livez for process liveness and keep /health as a backward-compatible liveness alias
  • add /readyz that checks database, Redis, and Soroban RPC with bounded timeouts
  • point the backend docker-compose healthcheck at /readyz

Validation

  • Static API validation: branch diff is 0 behind upstream main and changes only health routing, docker-compose healthcheck, and static coverage
  • GitHub Actions will run the project gates for this PR
  • Not run locally: project dependency/toolchain execution is intentionally avoided in this workspace

Comment thread quantara/web_app/tests/test_health_routes_static.py Fixed
Comment thread quantara/web_app/tests/test_health_routes_static.py Fixed
Comment thread quantara/web_app/tests/test_health_routes_static.py Fixed
assert '@app.get("/livez"' in MAIN_SOURCE
assert '@app.get("/health"' in MAIN_SOURCE
assert 'return await livez()' in MAIN_SOURCE
assert '@app.get("/readyz"' in MAIN_SOURCE
assert '@app.get("/health"' in MAIN_SOURCE
assert 'return await livez()' in MAIN_SOURCE
assert '@app.get("/readyz"' in MAIN_SOURCE
assert 'response.status_code = 503' in MAIN_SOURCE
assert "async def _check_redis" in MAIN_SOURCE
assert "async def _check_soroban_rpc" in MAIN_SOURCE
assert 'text("SELECT 1")' in MAIN_SOURCE
assert "client.ping()" in MAIN_SOURCE
assert "async def _check_soroban_rpc" in MAIN_SOURCE
assert 'text("SELECT 1")' in MAIN_SOURCE
assert "client.ping()" in MAIN_SOURCE
assert 'os.getenv("STELLAR_SOROBAN_RPC_URL")' in MAIN_SOURCE
assert 'text("SELECT 1")' in MAIN_SOURCE
assert "client.ping()" in MAIN_SOURCE
assert 'os.getenv("STELLAR_SOROBAN_RPC_URL")' in MAIN_SOURCE
assert '"method": "getHealth"' in MAIN_SOURCE


def test_backend_healthcheck_uses_readiness_endpoint():
assert "http://localhost:8000/readyz" in COMPOSE_SOURCE

def test_backend_healthcheck_uses_readiness_endpoint():
assert "http://localhost:8000/readyz" in COMPOSE_SOURCE
assert "http://localhost:8000/health" not in COMPOSE_SOURCE No newline at end of file


def test_liveness_and_compatibility_routes_are_separate_from_readiness():
assert '@app.get("/livez"' in MAIN_SOURCE

def test_liveness_and_compatibility_routes_are_separate_from_readiness():
assert '@app.get("/livez"' in MAIN_SOURCE
assert '@app.get("/health"' in MAIN_SOURCE
def test_liveness_and_compatibility_routes_are_separate_from_readiness():
assert '@app.get("/livez"' in MAIN_SOURCE
assert '@app.get("/health"' in MAIN_SOURCE
assert 'return {"status": "healthy", "database": "up", "redis": "up"}' in MAIN_SOURCE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split /health into /livez and /readyz

2 participants