PYTHON ?= python3 BASE_URL ?= http://localhost:8080 CA_FILE ?= ACTION_SCRIPT ?= API_CONTAINER = $(shell docker compose ps -q api | head -n 1) TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",) .PHONY: help up down migrate check validate lint format test load verify-lab4 help: @echo "Lab4: up, test, test-attachments, test-idempotency, test-lab4-review, test-reconciliation, test-upload-memory, test-attachment-failover, test-persistence-proof, test-clean-lab4, verify-lab4, export-submission" up: docker compose up -d --build --wait down: docker compose down migrate: docker compose run --rm migration check: $(PYTHON) scripts/check_contract.py validate: $(PYTHON) scripts/validate_openapi.py lint: $(PYTHON) -m ruff check src $(PYTHON) -m ruff format --check src format: $(PYTHON) -m ruff check --fix src $(PYTHON) -m ruff format src test: $(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS) load: $(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS) verify-lab4: $(PYTHON) scripts/verify-lab4.py .PHONY: test-attachments test-idempotency test-lab4-review test-reconciliation test-upload-memory test-attachments: $(PYTHON) tests/attachments.py --base-url "$(BASE_URL)" $(TLS_ARGS) test-idempotency: $(PYTHON) tests/idempotency.py --base-url "$(BASE_URL)" $(TLS_ARGS) test-lab4-review: $(PYTHON) tests/lab4_review.py --base-url "$(BASE_URL)" $(TLS_ARGS) test-reconciliation: scripts/test-reconciliation.sh test-upload-memory: PYTHON="$(PYTHON)" scripts/test-upload-memory.sh .PHONY: test-attachment-failover test-failover test-persistence test-persistence-proof test-clean-lab4 test-attachment-failover: $(PYTHON) tests/attachment_failover.py --base-url "$(BASE_URL)" $(TLS_ARGS) test-failover: @test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT=scripts/stop-one.sh"; exit 2) $(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) test-persistence: @test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT=scripts/restart.sh"; exit 2) $(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) test-persistence-proof: $(PYTHON) scripts/test-persistence.py --action-script "scripts/restart.sh" --base-url "$(BASE_URL)" $(TLS_ARGS) test-clean-lab4: $(PYTHON) scripts/test-clean-lab4.py .PHONY: reconcile reconcile-apply export-submission reconcile: docker compose exec -T reconciler python -m src.maintenance.reconcile reconcile-apply: docker compose exec -T reconciler python -m src.maintenance.reconcile --apply export-submission: $(PYTHON) scripts/export-submission.py