fix: enforce durable migration ownership and readiness
This commit is contained in:
parent
14befd0b50
commit
826874a47e
5 changed files with 52 additions and 0 deletions
|
|
@ -89,6 +89,22 @@ def test_postgresql_readiness_fails_when_database_is_unavailable() -> None:
|
|||
asyncio.run(store.aclose())
|
||||
|
||||
|
||||
def test_postgresql_readiness_fails_when_runtime_tables_are_unavailable(tmp_path) -> None:
|
||||
database_url = f"sqlite+aiosqlite:///{tmp_path / 'empty.db'}"
|
||||
store = PostgresPortStore.from_url(database_url)
|
||||
settings = RuntimeSettings(
|
||||
environment="production",
|
||||
backend="postgresql",
|
||||
allow_ephemeral=False,
|
||||
database_url=database_url,
|
||||
)
|
||||
response = TestClient(create_app(settings=settings, port_store=store)).get("/readyz")
|
||||
|
||||
assert response.status_code == 503
|
||||
assert response.json()["checks"]["database"] == "unavailable"
|
||||
asyncio.run(store.aclose())
|
||||
|
||||
|
||||
def _event(event_type: str) -> dict:
|
||||
return {
|
||||
"schema_version": "0.1.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue