fix: name postgres log read failures in failure checks
docker compose logs runs with check=False; a non-zero exit prints "postgres log unavailable" and fails the run instead of being reported as a setup failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -175,9 +175,24 @@ def cleanup(project: str, containers: list[str]) -> bool:
|
|||||||
|
|
||||||
def postgres_log_check(project: str) -> int:
|
def postgres_log_check(project: str) -> int:
|
||||||
"""Журнал PostgreSQL стенда отказов: сводка всегда, признаки аварии —
|
"""Журнал PostgreSQL стенда отказов: сводка всегда, признаки аварии —
|
||||||
строками; 1 — признаки есть. Два счётчика
|
строками; 1 — признаки есть или журнал не прочитан. Два счётчика
|
||||||
FATAL показывают, что заполнение и освобождение слотов правда были."""
|
FATAL показывают, что заполнение и освобождение слотов правда были."""
|
||||||
log = dc(project, "logs", "--no-log-prefix", "postgres", quiet=True)
|
log = dc(
|
||||||
|
project,
|
||||||
|
"logs",
|
||||||
|
"--no-log-prefix",
|
||||||
|
"postgres",
|
||||||
|
check=False,
|
||||||
|
quiet=True,
|
||||||
|
)
|
||||||
|
if log.returncode != 0:
|
||||||
|
# сбой чтения журнала — не сбой подготовки стенда
|
||||||
|
tail = log.stderr.strip().splitlines()[-1:] or ["no stderr"]
|
||||||
|
say(
|
||||||
|
f"postgres log unavailable: docker compose logs exited "
|
||||||
|
f"{log.returncode}: {tail[0]}",
|
||||||
|
)
|
||||||
|
return 1
|
||||||
lines = (log.stdout + log.stderr).splitlines()
|
lines = (log.stdout + log.stderr).splitlines()
|
||||||
crashes = [line for line in lines if any(m in line for m in CRASH_MARKERS)]
|
crashes = [line for line in lines if any(m in line for m in CRASH_MARKERS)]
|
||||||
too_many = sum("too many clients" in line for line in lines)
|
too_many = sum("too many clients" in line for line in lines)
|
||||||
|
|||||||
Reference in New Issue
Block a user