forked from mtusi2026/mtusi2026lab2
47 lines
1.7 KiB
Makefile
47 lines
1.7 KiB
Makefile
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
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
|
|
|
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)
|
|
|
|
.PHONY: setup ready student-checks experiment backup-restore test-dependencies test-expiry
|
|
setup:
|
|
bash scripts/setup.sh
|
|
ready:
|
|
BASE_URL="$(BASE_URL)" $(PYTHON) scripts/wait_ready.py
|
|
student-checks:
|
|
$(PYTHON) student-tests/checks.py --base-url "$(BASE_URL)"
|
|
$(PYTHON) student-tests/test_api.py --base-url "$(BASE_URL)"
|
|
docker compose exec -T api python student-tests/database.py
|
|
docker compose exec -T api python student-tests/test_lifecycle.py
|
|
experiment:
|
|
@mkdir -p evidence
|
|
docker compose run --rm -T --no-deps --user "$(shell id -u):$(shell id -g)" -v "$(CURDIR)/evidence:/app/evidence" api python -m scripts.experiment
|
|
backup-restore:
|
|
bash scripts/backup_restore.sh
|
|
test-dependencies:
|
|
$(PYTHON) student-tests/dependencies.py --base-url "$(BASE_URL)" --stop-cache scripts/stop-cache.sh --start-cache scripts/start-cache.sh --stop-db scripts/stop-db.sh --start-db scripts/start-db.sh
|
|
test-expiry:
|
|
bash scripts/test_expiry.sh
|