ЛР4 - БВТ2302 - Никитина - на 5
This commit is contained in:
@@ -1,30 +1,48 @@
|
||||
PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
PYTHON ?= python
|
||||
BASE_URL ?= http://127.0.0.1:8080
|
||||
CA_FILE ?=
|
||||
IMAGE ?= mtusi-messenger:lab3
|
||||
CONTAINER ?= mtusi-messenger-lab3
|
||||
|
||||
.PHONY: help check validate test load test-persistence test-failover
|
||||
# Флаг -X utf8 заставляет Python всегда использовать кодировку UTF-8 (лечит ошибку на Windows)
|
||||
PY = $(PYTHON) -X utf8
|
||||
|
||||
.PHONY: help check validate test build run stop student-tests experiment test-persistence test-failover
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@echo "targets: check validate test build run stop student-tests experiment test-persistence test-failover"
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
$(PY) scripts/check_contract.py
|
||||
|
||||
validate:
|
||||
$(PYTHON) scripts/validate_openapi.py
|
||||
$(PY) scripts/validate_openapi.py
|
||||
|
||||
test:
|
||||
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
$(PY) tests/smoke.py --base-url $(BASE_URL)
|
||||
|
||||
load:
|
||||
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
# Для Лабораторной 3 мы используем Docker Compose с масштабированием
|
||||
build:
|
||||
docker compose build
|
||||
|
||||
run:
|
||||
docker compose up -d --scale api=2
|
||||
|
||||
stop:
|
||||
docker compose down
|
||||
|
||||
student-tests:
|
||||
$(PY) student-tests/test_negative.py --base-url $(BASE_URL)
|
||||
$(PY) student-tests/test_pagination.py --base-url $(BASE_URL)
|
||||
$(PY) student-tests/test_concurrency.py --base-url $(BASE_URL)
|
||||
|
||||
experiment:
|
||||
$(PY) student-tests/load_experiment.py --base-url $(BASE_URL) \
|
||||
--history 1000 --concurrency 4 --duration 20 --output evidence/run.json
|
||||
|
||||
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)
|
||||
$(PY) tests/test_persistence.py --base-url $(BASE_URL) --action-script $(ACTION_SCRIPT)
|
||||
|
||||
|
||||
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)
|
||||
$(PY) tests/failover.py --base-url $(BASE_URL) --action-script "$(ACTION_SCRIPT)"
|
||||
Reference in New Issue
Block a user