From 1758790e5c1bb75ed67c6d83f031a0a7724a53ed Mon Sep 17 00:00:00 2001 From: roman Date: Tue, 13 Oct 2026 18:23:23 +0300 Subject: [PATCH] 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 --- student-tests/run_failures.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/student-tests/run_failures.py b/student-tests/run_failures.py index 73ab0888..d0a64beb 100644 --- a/student-tests/run_failures.py +++ b/student-tests/run_failures.py @@ -175,9 +175,24 @@ def cleanup(project: str, containers: list[str]) -> bool: def postgres_log_check(project: str) -> int: """Журнал PostgreSQL стенда отказов: сводка всегда, признаки аварии — - строками; 1 — признаки есть. Два счётчика + строками; 1 — признаки есть или журнал не прочитан. Два счётчика 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() 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)