forked from mtusi2026/mtusi2026lab4
48 lines
1.8 KiB
Makefile
48 lines
1.8 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 test-failover
|
|
|
|
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)
|
|
|
|
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)
|
|
|
|
# ---- student additions (lab4); public targets above are unchanged ----
|
|
.PHONY: test-lab3 test-level4 check-s3 sweep-dry memory rolling-restart
|
|
test-lab3:
|
|
$(PYTHON) student-tests/lab3_idempotency_checks.py --base-url "$(BASE_URL)"
|
|
test-level4:
|
|
$(PYTHON) student-tests/level4_checks.py --base-url "$(BASE_URL)"
|
|
$(PYTHON) -m unittest discover -s student-tests -p "test_*.py"
|
|
check-s3:
|
|
sh scripts/check_s3_exposure.sh
|
|
docker compose run --rm --no-deps --entrypoint python api scripts/check_s3_private.py
|
|
sweep-dry:
|
|
docker compose run --rm --no-deps s3_sweeper python scripts/s3_sweep.py --grace-seconds 3600
|
|
memory:
|
|
$(PYTHON) student-tests/memory_experiment.py --base-url "$(BASE_URL)" --concurrency 10
|
|
rolling-restart:
|
|
sh scripts/rolling-restart.sh
|