test: add automatic failure checks on a separate stand

make failure_checks brings up a throwaway compose project with its own
PostgreSQL and Valkey, a default and a tight API (2 s sessions, pool of
one), and runs the pytest tests marked fault through an explicit hook:
session expiry, database stop and return, pool exhaustion, chat creation
rollback, readiness, Valkey stop, hang, return and flush. The stand and
its volume are removed on any outcome; the working stand is untouched.
Regular runs deselect the fault tests, and 13 coverage exclusions go away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 23:20:34 +03:00
co-authored by Claude Opus 5.5
parent 3e79c6360f
commit 5b65051a60
19 changed files with 1648 additions and 114 deletions
+7
View File
@@ -83,6 +83,13 @@ timeout_graceful_shutdown=..., log_config=None, access_log=False)`.
базе (`student-tests.md`); Valkey общий с рабочим стендом, ключи кэша
разделены именем базы. Скрипт запускается `$(PYTHON)`, а не
`uv run`: uv повторно пересылает SIGINT, и Ctrl+C обрывал уборку.
- `failure_checks: env_setup` — проверки отказов на отдельном стенде,
проект compose `<рабочий>-failures` (`student-tests.md`). От
`start_db` не зависит: стенд свой и удаляется вместе с volume.
`FAULT_ARGS` — аргументы pytest (`make failure_checks FAULT_ARGS='-k
valkey'`). Скрипт тоже запускается `$(PYTHON)`. Все команды docker
проекта отказов — только с `-p <рабочий>-failures`: `down -v` без
него удалил бы рабочий volume.
## Troubleshooting