forked from mtusi2026/mtusi2026lab3
51 lines
1.8 KiB
Makefile
51 lines
1.8 KiB
Makefile
PYTHON ?= python
|
|
BASE_URL ?= http://localhost:8080
|
|
CA_FILE ?=
|
|
ACTION_SCRIPT ?=
|
|
SESSION_TTL_SECONDS ?=
|
|
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
|
|
|
.PHONY: help check validate test load test-persistence test-failover test-expiry test-dependency collect-evidence up down
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
|
@echo "test-persistence/test-failover: ACTION_SCRIPT=scripts/restart.sh|scripts/stop-one.sh"
|
|
@echo "test-expiry: SESSION_TTL_SECONDS=2 (стенд должен быть запущен с коротким TTL)"
|
|
@echo "test-dependency: остановка Redis/PostgreSQL через scripts/stop-*.sh"
|
|
@echo "collect-evidence: собрать evidence/*.txt (Windows: sh scripts/collect-evidence.sh)"
|
|
|
|
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:
|
|
$(if $(ACTION_SCRIPT),,$(error Set ACTION_SCRIPT to your implemented executable restart hook))
|
|
$(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-failover:
|
|
$(if $(ACTION_SCRIPT),,$(error Set ACTION_SCRIPT to your implemented executable stop-one hook))
|
|
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-expiry:
|
|
$(PYTHON) tests/test_expiry.py --base-url "$(BASE_URL)" $(if $(SESSION_TTL_SECONDS),--ttl $(SESSION_TTL_SECONDS),)
|
|
|
|
test-dependency:
|
|
$(PYTHON) tests/test_dependency_failure.py --base-url "$(BASE_URL)"
|
|
|
|
collect-evidence:
|
|
sh scripts/collect-evidence.sh
|
|
|
|
up:
|
|
docker compose --env-file .env up -d --build
|
|
|
|
down:
|
|
docker compose --env-file .env down
|