Recover stale PostgreSQL connections before starting requests

This commit is contained in:
Artyom
2026-11-05 21:55:14 +03:00
parent 18de595740
commit 0a1f48bd73
13 changed files with 232 additions and 8 deletions
+7
View File
@@ -211,6 +211,13 @@ async def test_postgres_stopped_gives_bounded_503_and_recovers(http: AsyncClient
me = await http.get("/api/v1/users/me", headers=bearer(token))
print(f"postgres запущен: готовность через {recovered:.1f} с, прежний токен {me.status_code}")
assert me.json() == user
instances = set()
for _ in range(40):
response = await http.post("/api/v1/users", json=new_user("recovered"))
assert response.status_code == 201
instances.add(response.headers["X-Instance-Id"])
print(f"postgres запущен: 40 регистраций 201 через {len(instances)} реплики без рестарта API")
assert len(instances) >= 2
assert started_at("api") == api_started