forked from mtusi2026/mtusi2026lab3
46 lines
1.8 KiB
Makefile
46 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)",)
|
|
|
|
OUTPUT ?=
|
|
OUTPUT_ARGS = $(if $(OUTPUT),--output "$(OUTPUT)",)
|
|
|
|
.PHONY: help check validate test load test-grade4 test-persistence test-failover test-failover-target rolling-restart
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI; test: public smoke; test-grade4: shared idempotency and replica distribution"
|
|
@echo "load: synthetic writes; test-persistence/test-failover: ACTION_SCRIPT hooks; rolling-restart: serial API restarts"
|
|
@echo "test-failover-target: TARGET_INSTANCE_ID=<X-Instance-Id> OUTPUT=<json file>"
|
|
|
|
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)" $(OUTPUT_ARGS) $(TLS_ARGS)
|
|
|
|
test-grade4:
|
|
$(PYTHON) tests/grade4.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-failover-target:
|
|
@test -n "$(TARGET_INSTANCE_ID)" || (echo "Set TARGET_INSTANCE_ID from X-Instance-Id"; exit 2)
|
|
$(PYTHON) tests/replica_failover.py --target-id "$(TARGET_INSTANCE_ID)" --action-script scripts/stop-one.sh $(OUTPUT_ARGS) --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
rolling-restart:
|
|
./scripts/rolling-restart.sh
|