forked from mtusi2026/mtusi2026lab2
Лабораторная работа 2
This commit is contained in:
@@ -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
|
||||
.PHONY: help check validate test load test-persistence secrets up down migrate test-student test-expiry test-storage test-failures explain
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@@ -24,3 +24,38 @@ load:
|
||||
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)
|
||||
|
||||
#Решение
|
||||
COMPOSE ?= docker compose --env-file .env
|
||||
EXPIRY_URL ?= http://localhost:8081
|
||||
|
||||
secrets:
|
||||
$(PYTHON) scripts/init_secrets.py
|
||||
@test -f .env || cp .env.example .env
|
||||
|
||||
up: secrets
|
||||
$(COMPOSE) up -d --build --wait
|
||||
|
||||
down:
|
||||
$(COMPOSE) --profile ttl down
|
||||
|
||||
migrate:
|
||||
$(COMPOSE) exec api python -m src.migrate
|
||||
|
||||
test-student:
|
||||
BASE_URL="$(BASE_URL)" $(PYTHON) student-tests/run_all.py --base-url "$(BASE_URL)"
|
||||
|
||||
test-expiry:
|
||||
$(COMPOSE) --profile ttl up -d --wait api-short-ttl
|
||||
EXPIRY_BASE_URL="$(EXPIRY_URL)" BASE_URL="$(BASE_URL)" $(PYTHON) -m unittest discover -s student-tests -p test_expiry.py -v
|
||||
|
||||
test-storage:
|
||||
$(COMPOSE) run --rm --no-deps -v "$(CURDIR)/student-tests:/app/student-tests:ro" api \
|
||||
python -m unittest discover -s student-tests -p test_storage_rollback.py -v
|
||||
|
||||
test-failures:
|
||||
$(PYTHON) student-tests/dependency_failure.py --base-url "$(BASE_URL)" --output evidence/dependency_failure.json
|
||||
|
||||
explain:
|
||||
$(COMPOSE) exec -T postgres psql -U messenger -d messenger -v ON_ERROR_STOP=1 < scripts/sql/explain_history.sql > evidence/explain_history.txt
|
||||
@echo "saved evidence/explain_history.txt"
|
||||
|
||||
Reference in New Issue
Block a user