feat: база из лабораторной 3 перенесена в лабу 4

This commit is contained in:
2026-11-10 16:24:08 +03:00
parent ec540a1a72
commit fc3ab1ca38
27 changed files with 1273 additions and 1374 deletions
+25 -20
View File
@@ -1,30 +1,35 @@
PYTHON ?= python3
BASE_URL ?= http://localhost:8080
CA_FILE ?=
ACTION_SCRIPT ?=
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
COMPOSE ?= docker compose
.PHONY: help check validate test load test-persistence test-failover
.PHONY: up down migrate restart test logs stop-one restart-one clean check
help:
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
up:
$(COMPOSE) up -d --build
down:
$(COMPOSE) down
migrate:
$(COMPOSE) exec api1 ./migrate up
restart:
$(COMPOSE) restart
test:
$(PYTHON) tests/client.py
$(PYTHON) tests/load.py
check:
$(PYTHON) scripts/check_contract.py
validate:
$(PYTHON) scripts/validate_openapi.py
logs:
$(COMPOSE) logs -f
test:
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
stop-one:
./scripts/stop-one.sh api1
load:
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
restart-one:
./scripts/restart-one.sh api1
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)
clean: down
$(COMPOSE) down -v