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-dependencies stand-up stand-down stand-status wait-ready init-env test-e2e s3-security consistency bench help: @echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes; init-env: .env + secrets; test-e2e: app e2e; s3-security; consistency; bench" 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) test-failover: @test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2) $(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) COMPOSE_ENV_FILE ?= .env COMPOSE = docker compose --env-file $(COMPOSE_ENV_FILE) test-dependencies: cd app && E2E_COMPOSE_DIR="$(CURDIR)" E2E_COMPOSE_ENV_FILE="$(COMPOSE_ENV_FILE)" npm run test:dependencies stand-up: $(COMPOSE) up -d --build --wait stand-down: $(COMPOSE) down stand-status: $(COMPOSE) ps wait-ready: @for attempt in $$(seq 1 60); do \ if curl -fsS "$(BASE_URL)/health/ready" >/dev/null 2>&1; then \ echo "stand is ready ($(BASE_URL))"; exit 0; \ fi; \ sleep 1; \ done; \ echo "stand did not become ready within 60s" >&2; exit 1 init-env: ./scripts/init-env.sh test-e2e: scripts/app-e2e.sh s3-security: scripts/lab4/check_s3_security.sh consistency: scripts/lab4/consistency_check.sh bench: scripts/lab4/run_matrix.sh