forked from mtusi2026/mtusi2026lab3
70 lines
2.4 KiB
Makefile
70 lines
2.4 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 up down test load test-persistence test-failover \
|
|
test-student test-expiry test-idempotency test-routing \
|
|
test-idempotency-persistence test-failover-matrix test-rolling test-track1
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt)"
|
|
@echo "up/down: local compose stack; test: public smoke against running LB"
|
|
@echo "test-persistence ACTION_SCRIPT=scripts/restart.sh"
|
|
@echo "test-failover ACTION_SCRIPT=scripts/stop-one.sh"
|
|
@echo "test-student/test-expiry/test-idempotency/test-routing: extra checks"
|
|
|
|
up:
|
|
docker compose --env-file .env up -d --build
|
|
|
|
down:
|
|
docker compose --env-file .env down
|
|
|
|
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)
|
|
|
|
test-student:
|
|
$(PYTHON) student-tests/auth_negative.py --base-url "$(BASE_URL)"
|
|
$(PYTHON) student-tests/race_username.py --base-url "$(BASE_URL)"
|
|
$(PYTHON) student-tests/idempotency_race.py --base-url "$(BASE_URL)"
|
|
$(PYTHON) student-tests/instance_routing.py --base-url "$(BASE_URL)"
|
|
|
|
test-expiry:
|
|
$(PYTHON) student-tests/expiry.py --base-url "$(BASE_URL)"
|
|
|
|
test-idempotency:
|
|
$(PYTHON) student-tests/idempotency_race.py --base-url "$(BASE_URL)"
|
|
|
|
test-routing:
|
|
$(PYTHON) student-tests/instance_routing.py --base-url "$(BASE_URL)"
|
|
|
|
test-idempotency-persistence:
|
|
$(PYTHON) student-tests/idempotency_persistence.py --base-url "$(BASE_URL)"
|
|
|
|
test-failover-matrix:
|
|
$(PYTHON) student-tests/failover_matrix.py --base-url "$(BASE_URL)"
|
|
|
|
test-rolling:
|
|
$(PYTHON) student-tests/rolling_update.py --base-url "$(BASE_URL)"
|
|
|
|
test-track1:
|
|
$(PYTHON) student-tests/track1_experiment.py --base-url "$(BASE_URL)"
|