forked from mtusi2026/mtusi2026lab3
Горизонтальное масштабирование за LB с общими сессиями Redis, X-Instance-Id, обязательным Idempotency-Key в PostgreSQL, сценариями failover/persistence и измерением цены масштабирования при фиксированном CPU/RAM бюджете.
45 lines
1.2 KiB
Makefile
45 lines
1.2 KiB
Makefile
PYTHON ?= python3
|
|
BASE_URL ?= http://localhost:8080
|
|
CA_FILE ?=
|
|
ACTION_SCRIPT ?=
|
|
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
|
|
|
GO ?= go
|
|
|
|
.PHONY: help check validate test load test-persistence test-failover student-test up down track1
|
|
|
|
help:
|
|
@echo "up: build+scale API behind LB; test/test-persistence/test-failover/student-test/track1"
|
|
|
|
check:
|
|
$(PYTHON) scripts/check_contract.py
|
|
|
|
validate:
|
|
$(PYTHON) scripts/validate_openapi.py
|
|
|
|
up:
|
|
bash scripts/up.sh
|
|
|
|
down:
|
|
docker compose --env-file .env down
|
|
|
|
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-test:
|
|
$(GO) test ./student-tests/ -v -count=1 -timeout 180s
|
|
|
|
track1:
|
|
bash scripts/run_track1.sh
|