forked from mtusi2026/mtusi2026lab3
lab3: Nginx, реплики и идемпотентность
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
PUBLIC_PORT ?= $(or $(shell sed -n 's/^PUBLIC_PORT=//p' .env 2>/dev/null),8080)
|
||||
BASE_URL ?= http://localhost:$(PUBLIC_PORT)
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
@@ -28,3 +29,52 @@ 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)
|
||||
|
||||
.PHONY: unit-test student-test concurrency lab3-test
|
||||
unit-test:
|
||||
docker compose run --rm --no-deps -v "$(CURDIR)/student-tests:/app/student-tests:ro" api-a python /app/student-tests/unit_test.py
|
||||
|
||||
student-test:
|
||||
$(PYTHON) student-tests/run.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
concurrency:
|
||||
$(PYTHON) student-tests/concurrency.py --base-url "$(BASE_URL)" --clients 10 --messages-per-client 10 --output evidence/concurrency.json $(TLS_ARGS)
|
||||
|
||||
lab3-test:
|
||||
$(PYTHON) student-tests/lab3.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
.PHONY: bootstrap up restore rolling-update test-dependencies test-expiry test-readiness test-failover-load test-rolling-load
|
||||
bootstrap:
|
||||
$(PYTHON) scripts/bootstrap.py
|
||||
|
||||
up:
|
||||
docker compose --env-file .env up -d --build
|
||||
|
||||
restore:
|
||||
$(PYTHON) scripts/manage.py restore
|
||||
|
||||
rolling-update:
|
||||
scripts/rolling-update.sh
|
||||
|
||||
test-dependencies:
|
||||
$(PYTHON) student-tests/dependencies.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
test-expiry:
|
||||
SESSION_TTL_SECONDS=2 docker compose up -d --no-deps --force-recreate api-a api-b
|
||||
$(PYTHON) scripts/manage.py restore
|
||||
@status=0; $(PYTHON) student-tests/dependencies.py --mode expiry --base-url "$(BASE_URL)" $(TLS_ARGS) || status=$$?; \
|
||||
docker compose up -d --no-deps --force-recreate api-a api-b; \
|
||||
$(PYTHON) scripts/manage.py restore; exit $$status
|
||||
|
||||
test-readiness:
|
||||
$(PYTHON) student-tests/readiness.py
|
||||
|
||||
test-failover-load:
|
||||
$(PYTHON) student-tests/experiments.py --base-url "$(BASE_URL)" --scenario failover $(TLS_ARGS)
|
||||
|
||||
test-rolling-load:
|
||||
$(PYTHON) student-tests/experiments.py --base-url "$(BASE_URL)" --scenario rolling $(TLS_ARGS)
|
||||
|
||||
.PHONY: test-storage
|
||||
test-storage:
|
||||
docker compose run --rm --no-deps -v "$(CURDIR)/student-tests:/app/student-tests:ro" api-a python /app/student-tests/storage.py
|
||||
|
||||
Reference in New Issue
Block a user