forked from mtusi2026/mtusi2026lab2
test: собственные тесты lab2 (unit, API, БД, отказы, сессии, EXPLAIN)
Гонка регистрации (ровно 1x201 + 7x409, одна строка), rollback после первого INSERT, повтор миграций, 10x10 сообщений, отказ/пауза PostgreSQL и Valkey с действующим токеном (503 в пределах дедлайна, восстановление в finally), lock_timeout, logout при отказе Valkey, короткий TTL, SESSION_STORE=postgres, EXPLAIN поздней страницы при generic plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
01524165dd
commit
a8c6af8c7d
@@ -24,3 +24,38 @@ load:
|
||||
test-persistence:
|
||||
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable restart hook"; exit 2)
|
||||
$(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Student solution (lab 2, Python). On Windows without make run the commands from
|
||||
# REPORT.md directly (public tests there need PYTHONUTF8=1; restart hook: scripts/restart.cmd).
|
||||
.PHONY: secrets up down logs ps migrate student-test unit-test explain
|
||||
|
||||
secrets:
|
||||
$(PYTHON) scripts/init_secrets.py
|
||||
|
||||
# Build, apply migrations (service migrate) and wait until every service is healthy.
|
||||
up: secrets
|
||||
docker compose up -d --build --wait
|
||||
|
||||
# Safe stop: containers stop, named volumes (data) stay.
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
logs:
|
||||
docker compose logs --tail 50 api
|
||||
|
||||
ps:
|
||||
docker compose ps
|
||||
|
||||
migrate:
|
||||
docker compose run --rm migrate
|
||||
|
||||
# Own tests: unit + black-box against the running stand (needs requirements*.txt in a venv).
|
||||
student-test:
|
||||
$(PYTHON) -m pytest student-tests -v
|
||||
|
||||
unit-test:
|
||||
$(PYTHON) -m pytest student-tests -m "not stack" -q
|
||||
|
||||
explain:
|
||||
$(PYTHON) scripts/explain_history.py --output evidence/explain-history.txt
|
||||
|
||||
Reference in New Issue
Block a user