fix: log 503 client error to stderr

This commit is contained in:
M. Taimoor Zaeem
2025-02-08 21:08:29 -05:00
committed by Steve Chavez
parent 3f78615dff
commit c96dc3ee90
3 changed files with 23 additions and 2 deletions
+19
View File
@@ -1696,3 +1696,22 @@ def test_jwt_cache_purges_expired_entries(defaultenv):
response = postgrest.session.get("/authors_only", headers=hdrs3)
assert response.status_code == 200
def test_pgrst_log_503_client_error_to_stderr(defaultenv):
"PostgREST should log 503 errors to stderr"
env = {
**defaultenv,
"PGAPPNAME": "test-io",
}
with run(env=env) as postgrest:
postgrest.session.get("/rpc/terminate_pgrst?appname=test-io")
output = postgrest.read_stdout(nlines=6)
log_message = '{"code":"PGRST001","details":"no connection to the server\\n","hint":null,"message":"Database client error. Retrying the connection."}\n'
assert any(log_message in line for line in output)