PYTHON ?= python3 BASE_URL ?= http://localhost:8080 CA_FILE ?= ACTION_SCRIPT ?= COMPOSE = docker compose --project-name highload-lab4 --env-file .env -f compose.yml TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",) .PHONY: help check validate test load test-persistence test-failover test-grade3 test-grade3-failures .PHONY: app-init app-build app-up app-start app-stop app-down app-restart app-logs app-status test-backend test-baseline test-baseline-persistence help: @echo "app-build: build application images; app-up: build and start the full stack" @echo "app-start: start without rebuilding; app-stop: stop and keep containers" @echo "app-down: remove containers and networks, keeping data volumes" @echo "app-restart: restart the stack; app-logs / app-status: inspect services" @echo "test-grade3 / test-grade3-failures: attachment checks; second target temporarily stops this stack services" @echo "test-backend: Go race tests; test-baseline: transferred API checks" @echo "test-baseline-persistence: transferred API checks across a restart" @echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes" app-init: $(PYTHON) scripts/init_env.py chmod +x scripts/restart.sh scripts/stop-one.sh app-build: app-init $(COMPOSE) build app-up: app-init $(COMPOSE) up -d --build --wait app-start: app-init $(COMPOSE) up -d --no-build --wait app-stop: $(COMPOSE) stop app-down: $(COMPOSE) down app-restart: app-init ./scripts/restart.sh app-logs: $(COMPOSE) logs -f --tail=100 app-status: $(COMPOSE) ps --all test-backend: app-init $(COMPOSE) --profile test run --build --rm backend-tests test-baseline: $(PYTHON) scripts/check_baseline.py --base-url "$(BASE_URL)" test-baseline-persistence: $(PYTHON) scripts/check_baseline.py --base-url "$(BASE_URL)" --restart test-grade3: $(PYTHON) scripts/check_grade3.py --base-url "$(BASE_URL)" test-grade3-failures: $(PYTHON) scripts/check_grade3.py --base-url "$(BASE_URL)" --failures 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)