feat: add replicated messenger and reproducible lab3 stand
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
# Что доказывает: решение собирается и проходит проверки из копии только
|
||||
# тех файлов, что попадут в git (как чистый clone): без .env, .venv,
|
||||
# кэшей и пробных меток стенда. На чистом отдельном стенде из этой копии
|
||||
# — smoke, свои тесты через LB с двумя репликами, test-failover и
|
||||
# test-persistence.
|
||||
# Дата (UTC): 2026-10-13T22:32:16Z — 2026-10-13T22:33:08Z
|
||||
# Окружение: macOS 26.6.2, Apple M3 Pro; Docker 29.8.2, Compose 5.5.1;
|
||||
# uv 0.12.17; python3 хоста 3.11.9
|
||||
# Как сделана копия: проект — не git-репозиторий, поэтому список файлов
|
||||
# взят у git с временным GIT_DIR вне проекта по правилам .gitignore:
|
||||
# git --git-dir=<tmp>/g init -q
|
||||
# git --git-dir=<tmp>/g --work-tree=. ls-files -co --exclude-standard -z \
|
||||
# | tar --null -T - -cf - | tar -xf - -C <tmp>/fresh
|
||||
# Код src_sha256 0349e9a270178467. Временные пути заменены на <tmp>;
|
||||
# строки docker compose о контейнерах, сети и сборке, список пакетов
|
||||
# uv sync опущены («...»).
|
||||
|
||||
$ cd <tmp>/fresh; find . -type f | wc -l; test -e .env || echo "no .env"; test -e .venv || echo "no .venv"; ls evidence
|
||||
135
|
||||
no .env
|
||||
no .venv
|
||||
AGENTS.md
|
||||
README.md
|
||||
failover
|
||||
replicas
|
||||
rollout
|
||||
stand
|
||||
tests
|
||||
|
||||
$ make check
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
|
||||
$ uv sync --frozen
|
||||
...
|
||||
|
||||
$ make lint
|
||||
uv run ruff format --check .
|
||||
84 files already formatted
|
||||
uv run ruff check .
|
||||
All checks passed!
|
||||
|
||||
$ make requirements-check
|
||||
requirements.txt matches uv.lock
|
||||
|
||||
$ make validate PYTHON=.venv/bin/python
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
|
||||
$ uv run python bench/analysis.py --selftest
|
||||
analysis selftest: ok
|
||||
|
||||
$ make test-isolated
|
||||
python3 student-tests/stand.py isolated
|
||||
[isolated] project=vladimirceva-lab3-isolated
|
||||
[isolated] build image
|
||||
...
|
||||
[isolated] start postgres and valkey
|
||||
...
|
||||
[isolated] migrations
|
||||
...
|
||||
2026-10-13T22:32:22.969Z INFO alembic.runtime.migration [rid=-] Running upgrade -> 0001, messenger schema: users, sessions, chats, chat members, messages
|
||||
2026-10-13T22:32:22.978Z INFO alembic.runtime.migration [rid=-] Running upgrade 0001 -> 0002, idempotency keys for sending messages
|
||||
2026-10-13T22:32:22.983Z INFO src.migrations [rid=-] migrations finished db=messenger
|
||||
...
|
||||
[isolated] ready: lb=http://127.0.0.1:63899 replicas=2
|
||||
[isolated] make test
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
[isolated] pytest
|
||||
...
|
||||
collected 99 items / 15 deselected / 84 selected
|
||||
...
|
||||
====================== 84 passed, 15 deselected in 14.00s ======================
|
||||
[isolated] make test-failover (scripts/stop-one.sh)
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 121, "failed_attempts": 0, "first_recovery_seconds": 1.2}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
[isolated] restore replicas
|
||||
...
|
||||
[isolated] make test-persistence (scripts/restart.sh)
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
[isolated] cleanup
|
||||
[isolated] results: {'test': 0, 'student-test': 0, 'test-failover': 0, 'test-persistence': 0}
|
||||
|
||||
# Из копии без локальных файлов: контракт и OpenAPI валидны, линтер чист,
|
||||
# requirements.txt совпадает с uv.lock, самопроверка разбора стенда
|
||||
# проходит, образ собирается, на пустой базе — миграции 0001 и 0002,
|
||||
# smoke PASS, 84 passed, test-failover и test-persistence PASS.
|
||||
# Отдельному стенду .env не нужен: пароли он генерирует сам. Настоящий
|
||||
# git clone — после публикации (REPORT.md); после замеров Codex
|
||||
# переснимает этот файл (bench/RUNBOOK.md, шаг 6).
|
||||
Reference in New Issue
Block a user