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:
@@ -157,13 +157,23 @@ make run_dev # Postgres + миграции, Valkey, затем 127.0.0.1:8080,
|
||||
```bash
|
||||
make check # офлайн-структура skeleton
|
||||
make test_isolated # образ на временной базе: smoke + student-tests, уборка
|
||||
make failure_checks # проверки отказов (~45 с) на отдельном стенде <рабочий>-failures
|
||||
make failure_checks FAULT_ARGS='-k valkey' # только часть проверок отказов
|
||||
python3 $D all # живой сервер + flow + smoke + student-tests
|
||||
make lint # ruff; затрагивает и driver.py
|
||||
```
|
||||
|
||||
Ожидаемо: `PASS: offline skeleton structure...`, `FAILED: none` у
|
||||
`flow`, smoke — `PASS: lab2 public API scenario...`, student — все
|
||||
прошли, `All checks passed!`; `all` и `test_isolated` — код 0.
|
||||
прошли (12 тестов `fault` — `deselected`), `All checks passed!`; `all`,
|
||||
`test_isolated` и `failure_checks` — код 0.
|
||||
|
||||
Проверки отказов (`student-tests/test_failures.py`, маркер `fault`)
|
||||
останавливают и замораживают Postgres и Valkey, поэтому идут только на
|
||||
своём стенде: `make failure_checks` поднимает проект compose
|
||||
`<рабочий>-failures` со своими хранилищами и volume и удаляет его после
|
||||
прогона. Рабочий стенд на 8080 при этом не трогается. `pytest -m fault`
|
||||
напрямую останавливается с кодом 2: нет hook стенда.
|
||||
|
||||
## Gotchas
|
||||
|
||||
|
||||
Reference in New Issue
Block a user