- re-capture coverage-exclusion evidence on the lab 4 stand: cache,
auth storage, replay after API recreate, test-persistence,
attachment-failover (stop, kill), attachment-storage
- green evidence/tests: student_test via LB, test_isolated,
failure_checks; smoke, slow transfer, test-failover per replica
- bench_rollout label attachments: e1161f7 -> schema with attachments
under load, no errors, messages = keys
- REPORT.md: attachments architecture, write order, defense answers,
level 3/4 evidence rows, limitations; PLAN.md stage 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
3.5 KiB
Markdown
72 lines
3.5 KiB
Markdown
# `make test-persistence` на стенде лабы 4
|
||
|
||
- Дата: 2026-10-20, 22:31:41–22:32:09 UTC.
|
||
- Commit: `d56b892` (код приложения — `116d8d3`, change `attachments`).
|
||
- Стенд: рабочий `mtusi-lab4` — HAProxy на `127.0.0.1:8080`, две
|
||
реплики API, PostgreSQL, Valkey, S3 (volumes `postgres_data`,
|
||
`s3_data`).
|
||
- Профиль проверки — `LAB=4` (`lab.json`): `tests/resilience.py`
|
||
создаёт пользователей, чат, сообщения и **вложение** (загрузка
|
||
`tests/fixtures/sample.png`), вызывает hook и прежним токеном читает
|
||
те же данные, метаданные вложения и его байты (`attachment lost or
|
||
changed across failure` при расхождении).
|
||
- Исключения сверки покрытия: `data-storage` «Прежний пользователь после
|
||
рестарта», `sessions` «Прежний токен после рестарта», `attachments`
|
||
«Рестарт стенда» (`student-tests/spec_coverage.py`).
|
||
|
||
## Контейнеры до
|
||
|
||
```
|
||
$ docker compose ps --format 'table {{.Name}}\t{{.Status}}'
|
||
NAME STATUS
|
||
mtusi-lab4-api-5 Up 18 seconds (healthy)
|
||
mtusi-lab4-api-6 Up 18 seconds (healthy)
|
||
mtusi-lab4-haproxy-1 Up 31 minutes (healthy)
|
||
mtusi-lab4-postgres-1 Up 31 minutes (healthy)
|
||
mtusi-lab4-s3-1 Up 31 minutes (healthy)
|
||
mtusi-lab4-valkey-1 Up 31 minutes (healthy)
|
||
$ docker inspect -f '{{.Name}} {{.State.StartedAt}}' $(docker compose ps -q)
|
||
/mtusi-lab4-api-5 2026-10-20T22:31:23.061386013Z
|
||
/mtusi-lab4-api-6 2026-10-20T22:31:23.117223013Z
|
||
/mtusi-lab4-haproxy-1 2026-10-20T21:59:55.165833875Z
|
||
/mtusi-lab4-postgres-1 2026-10-20T21:59:55.176395458Z
|
||
/mtusi-lab4-s3-1 2026-10-20T21:59:55.173230792Z
|
||
/mtusi-lab4-valkey-1 2026-10-20T21:59:55.154728458Z
|
||
```
|
||
|
||
## Проверка
|
||
|
||
```
|
||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
|
||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||
exit=0
|
||
```
|
||
|
||
## Контейнеры после
|
||
|
||
```
|
||
$ docker inspect -f '{{.Name}} {{.State.StartedAt}}' $(docker compose ps -q)
|
||
/mtusi-lab4-api-5 2026-10-20T22:32:07.759464589Z
|
||
/mtusi-lab4-api-6 2026-10-20T22:32:07.813974797Z
|
||
/mtusi-lab4-haproxy-1 2026-10-20T22:32:07.873866047Z
|
||
/mtusi-lab4-postgres-1 2026-10-20T22:31:42.768951925Z
|
||
/mtusi-lab4-s3-1 2026-10-20T22:31:57.790816751Z
|
||
/mtusi-lab4-valkey-1 2026-10-20T22:31:42.807267216Z
|
||
$ docker compose ps --format 'table {{.Name}}\t{{.Status}}'
|
||
NAME STATUS
|
||
mtusi-lab4-api-5 Up 2 seconds (healthy)
|
||
mtusi-lab4-api-6 Up 1 second (healthy)
|
||
mtusi-lab4-haproxy-1 Up 1 second (healthy)
|
||
mtusi-lab4-postgres-1 Up 27 seconds (healthy)
|
||
mtusi-lab4-s3-1 Up 11 seconds (healthy)
|
||
mtusi-lab4-valkey-1 Up 26 seconds (healthy)
|
||
```
|
||
|
||
- `StartedAt` у **всех** шести контейнеров новый: `scripts/restart.sh`
|
||
перезапустил обе реплики, LB, PostgreSQL, Valkey и S3 (S3 — плавно,
|
||
~15 с), те же контейнеры и volumes.
|
||
- После этого прежний токен читает те же данные, а скачанный оригинал
|
||
вложения совпадает с загруженным (проверка `resilience.py` с `LAB=4`).
|