forked from mtusi2026/mtusi2026lab3
Recover stale PostgreSQL connections before starting requests
This commit is contained in:
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
|
||||
import httpx
|
||||
|
||||
from conftest import DATABASE, new_user
|
||||
from conftest import DATABASE, free_port, new_user
|
||||
from messenger.shared.infrastructure.readiness import DRAINING
|
||||
|
||||
DRAIN = 1.0
|
||||
@@ -67,7 +67,7 @@ def begin_registration(port: int) -> tuple[socket.socket, bytes]:
|
||||
|
||||
|
||||
def test_sigterm_leaves_rotation_then_closes_and_cancels_stuck_requests(tmp_path: Path) -> None:
|
||||
port = 18083
|
||||
port = free_port()
|
||||
settings = {
|
||||
"HOST": "127.0.0.1",
|
||||
"PORT": str(port),
|
||||
@@ -98,6 +98,7 @@ def test_sigterm_leaves_rotation_then_closes_and_cancels_stuck_requests(tmp_path
|
||||
time.sleep(0.3)
|
||||
during = status(port, "/health/ready"), status(port, "/health/live")
|
||||
while status(port, "/health/live") == 200:
|
||||
assert time.monotonic() - sent < SHUTDOWN + 2, log_path.read_text()
|
||||
time.sleep(0.05)
|
||||
closed = time.monotonic() - sent
|
||||
pending.sendall(rest)
|
||||
|
||||
Reference in New Issue
Block a user