forked from mtusi2026/mtusi2026lab2
83 lines
2.9 KiB
Makefile
83 lines
2.9 KiB
Makefile
-include .env
|
|
|
|
API_PORT ?= 8080
|
|
PYTHON ?= $(if $(wildcard .venv/bin/python),.venv/bin/python,python3)
|
|
BASE_URL ?= http://localhost:$(API_PORT)
|
|
CA_FILE ?=
|
|
ACTION_SCRIPT ?= scripts/restart.sh
|
|
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
|
|
|
.PHONY: help build run up down restart check validate test student-test test-ui test-expiry test-grade4 test-dependencies explain-history verify-grade4 research-grade5 verify-grade5 load test-persistence
|
|
|
|
help:
|
|
@echo "build: compile C# API; run: start API with DATABASE_URL or DATABASE_URL_FILE"
|
|
@echo "up: start API/PostgreSQL/Redis; down: stop without deleting data; restart: restart all three"
|
|
@echo "check: offline skeleton structure; validate: full OpenAPI (requirements-dev.txt)"
|
|
@echo "test: public Lab2 smoke; student-test: additional Lab2 checks"
|
|
@echo "test-ui: optional web API authentication, privacy and backwards pagination"
|
|
@echo "test-expiry: short session TTL; test-persistence: restart check"
|
|
@echo "test-grade4: registration race, transaction rollback and Redis cache; test-dependencies: local outage checks"
|
|
@echo "explain-history: seed 10000 synthetic messages and capture EXPLAIN ANALYZE BUFFERS"
|
|
@echo "verify-grade4: run all checks on the running stack, save evidence/grade4-checks.txt"
|
|
@echo "research-grade5: 100000 messages, index comparison and independent backup/restore; verify-grade5: grades 3/4 + research"
|
|
|
|
build:
|
|
dotnet build src/Messenger.Api/Messenger.Api.csproj --nologo
|
|
|
|
run:
|
|
dotnet run --no-launch-profile --project src/Messenger.Api/Messenger.Api.csproj
|
|
|
|
up:
|
|
./scripts/init-secrets.sh
|
|
docker compose up -d --build --wait --wait-timeout 90
|
|
|
|
down:
|
|
docker compose down
|
|
|
|
restart:
|
|
./scripts/restart.sh
|
|
|
|
check:
|
|
$(PYTHON) scripts/check_contract.py
|
|
|
|
validate:
|
|
$(PYTHON) scripts/validate_openapi.py
|
|
|
|
test:
|
|
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
student-test:
|
|
$(PYTHON) student-tests/lab2_tests.py --base-url "$(BASE_URL)"
|
|
|
|
test-ui:
|
|
$(PYTHON) student-tests/ui_api_tests.py --base-url "$(BASE_URL)"
|
|
|
|
test-grade4:
|
|
$(PYTHON) student-tests/grade4_tests.py --base-url "$(BASE_URL)"
|
|
|
|
test-dependencies:
|
|
$(PYTHON) student-tests/dependency_tests.py --base-url "$(BASE_URL)"
|
|
|
|
explain-history:
|
|
$(PYTHON) student-tests/explain_history.py --base-url "$(BASE_URL)"
|
|
|
|
verify-grade4:
|
|
BASE_URL="$(BASE_URL)" PYTHON="$(PYTHON)" ./scripts/verify-grade4.sh
|
|
@echo "PASS: grade 4 checks; results in evidence/grade4-checks.txt"
|
|
|
|
research-grade5:
|
|
$(PYTHON) -u student-tests/research_track2.py --base-url "$(BASE_URL)"
|
|
|
|
verify-grade5:
|
|
BASE_URL="$(BASE_URL)" PYTHON="$(PYTHON)" ./scripts/verify-grade5.sh
|
|
|
|
test-expiry:
|
|
BASE_URL="$(BASE_URL)" PYTHON="$(PYTHON)" ./scripts/test-expiry.sh
|
|
|
|
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)
|