forked from mtusi2026/mtusi2026lab2
57 lines
2.1 KiB
Makefile
57 lines
2.1 KiB
Makefile
PYTHON ?= python3
|
|
BASE_URL ?= http://localhost:8080
|
|
CA_FILE ?=
|
|
ACTION_SCRIPT ?=
|
|
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
|
|
|
.PHONY: help check validate test load test-persistence up down test-student test-rollback test-expiry test-deps explain track2-indexes track2-restore
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
|
|
|
check:
|
|
$(PYTHON) scripts/check_contract.py
|
|
|
|
validate:
|
|
$(PYTHON) scripts/validate_openapi.py
|
|
|
|
test:
|
|
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
load:
|
|
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
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)
|
|
|
|
# ---- Цели студента (публичные цели выше не менялись) ----
|
|
up:
|
|
sh scripts/init-secrets.sh
|
|
docker compose --env-file .env up -d --build
|
|
|
|
# Намеренно БЕЗ -v: тома (данные) сохраняются. Удаление данных: docker compose --env-file .env down -v
|
|
down:
|
|
docker compose --env-file .env down
|
|
|
|
test-student:
|
|
cd tests_student && $(PYTHON) test_integration.py
|
|
|
|
test-rollback:
|
|
docker compose --env-file .env run --rm --no-deps -v "$(CURDIR)/tests_student:/srv/tests_student:ro" api python tests_student/test_db_rollback.py
|
|
|
|
test-expiry:
|
|
sh scripts/test-expiry.sh
|
|
|
|
test-deps:
|
|
cd tests_student && $(PYTHON) test_dependencies.py
|
|
|
|
# Трек 5.2: нужна ОТДЕЛЬНАЯ БД эксперимента (DATABASE_URL_FILE) и второй сервер PostgreSQL для восстановления.
|
|
track2-indexes:
|
|
$(PYTHON) scripts/track2_indexes.py --out evidence/track2-indexes.json
|
|
$(PYTHON) scripts/track2_indexes.py --reverse --out evidence/track2-indexes-pass2.json
|
|
|
|
track2-restore:
|
|
@test -n "$(SRC_URL)" -a -n "$(DST_ADMIN_URL)" || (echo "Set SRC_URL and DST_ADMIN_URL"; exit 2)
|
|
$(PYTHON) scripts/track2_restore.py --src-url "$(SRC_URL)" --dst-admin-url "$(DST_ADMIN_URL)" --out evidence/track2-restore.json
|