fix: not logging termination unix signals

Under container environments like ECS, it's hard to know when PostgREST
is being terminated.
This commit is contained in:
steve-chavez
2026-03-20 13:38:40 -05:00
parent dade15acc4
commit 1856434a74
5 changed files with 36 additions and 10 deletions
+18
View File
@@ -105,6 +105,24 @@ def test_flush_pool_no_interrupt(defaultenv):
t.join()
def test_termination_unix_signal_logging(defaultenv):
"Server logs when handling termination unix signals."
with run(env=defaultenv) as postgrest:
postgrest.process.send_signal(signal.SIGTERM)
lines = postgrest.read_stdout(nlines=1)
wait_until_exit(postgrest)
assert any("SIGTERM" in line for line in lines)
with run(env=defaultenv) as postgrest:
postgrest.process.send_signal(signal.SIGINT)
lines = postgrest.read_stdout(nlines=1)
wait_until_exit(postgrest)
assert any("SIGINT" in line for line in lines)
def test_random_port_bound(defaultenv):
"PostgREST should bind to a random port when PGRST_SERVER_PORT is 0."