ЛР 3: масштабирование и отказоустойчивость API

This commit is contained in:
EgorAnti
2026-11-03 20:53:02 +03:00
parent 0ab3a341aa
commit 8105f90097
115 changed files with 5018 additions and 38 deletions
+19 -3
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 test-idempotency load test-persistence test-failover test-failover-each test-rolling swarm-up test-node-failover swarm-down
help:
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
@@ -18,13 +18,29 @@ validate:
test:
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
test-idempotency:
$(PYTHON) student_tests/idempotency_concurrent.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-failover-each:
$(PYTHON) student_tests/failover_each.py --action-script "$(ACTION_SCRIPT)" --restore-script "$(RESTORE_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
test-rolling:
$(PYTHON) student_tests/rolling_update.py --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
swarm-up:
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/swarm-lab-up.ps1
test-node-failover:
$(PYTHON) student_tests/node_failover.py --base-url "http://localhost:18080" --output "evidence/node-failover.json"
swarm-down:
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/swarm-lab-down.ps1