forked from mtusi2026/mtusi2026lab3
Реплика больше не держит корректность в своей памяти: сессия в Redis, а повтор POST сообщения фиксируется в Postgres вместе с X-Instance-Id.
49 lines
1.6 KiB
Makefile
49 lines
1.6 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 test-failover test-student test-infra test-expiry explain evidence-grade4 evidence-track1
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
|
|
|
check:
|
|
$(PYTHON) -X utf8 scripts/check_contract.py
|
|
|
|
validate:
|
|
$(PYTHON) -X utf8 scripts/validate_openapi.py
|
|
|
|
test:
|
|
$(PYTHON) -X utf8 tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
load:
|
|
$(PYTHON) -X utf8 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) -X utf8 tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-failover:
|
|
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2)
|
|
$(PYTHON) -X utf8 tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-student:
|
|
$(PYTHON) -m pytest student_tests -q -m "not infra and not expiry"
|
|
|
|
test-infra:
|
|
RUN_INFRA=1 $(PYTHON) -m pytest student_tests/test_infra.py -q -m infra
|
|
|
|
test-expiry:
|
|
$(PYTHON) scripts/run_expiry.py
|
|
|
|
explain:
|
|
docker compose --env-file .env exec -T api python -m app.tools.explain
|
|
|
|
evidence-grade4:
|
|
$(PYTHON) -X utf8 scripts/grade4_evidence.py
|
|
|
|
evidence-track1:
|
|
$(PYTHON) -X utf8 scripts/track1_experiment.py
|