выполнение ЛР3 на 4

This commit is contained in:
Ilya
2026-10-21 12:20:11 +03:00
parent 0ab3a341aa
commit 6f4f74d691
37 changed files with 2854 additions and 15 deletions
+26 -1
View File
@@ -4,7 +4,7 @@ CA_FILE ?=
ACTION_SCRIPT ?=
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
.PHONY: help check validate test load test-persistence test-failover
.PHONY: help check validate test load test-persistence test-failover secrets up down restore rolling-update test-student chaos
help:
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
@@ -28,3 +28,28 @@ test-persistence:
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)
secrets:
sh scripts/init-secrets.sh
up: secrets
docker compose up -d --build --wait
down:
docker compose down
restore:
sh scripts/restore.sh
rolling-update:
sh scripts/rolling-update.sh
test-student:
$(PYTHON) student-tests/idempotency_test.py --base-url "$(BASE_URL)"
chaos:
@for n in 1 2; do \
name=$$(docker compose ps --format '{{.Name}}' api | sed -n "$${n}p"); \
$(PYTHON) student-tests/chaos_load.py --base-url "$(BASE_URL)" --action "scripts/stop-container.sh $$name" --output evidence/failover-load/stop-api-$$n.json | tail -8; \
sh scripts/restore.sh >/dev/null 2>&1; sleep 3; \
done