forked from mtusi2026/mtusi2026lab2
ЛР 2: мессенджер на PostgreSQL и сессии в Redis
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
PYTHON ?= python3
|
||||
PYTHON ?= $(if $(wildcard .venv/bin/python),.venv/bin/python,python3)
|
||||
BASE_URL ?= http://localhost:8080
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
COMPOSE_ENV ?= .env
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
|
||||
.PHONY: help check validate test load test-persistence
|
||||
.PHONY: help check validate test test-docker test-dependencies explain-messages load test-persistence
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@echo "check: offline structure; validate: full OpenAPI; test: running API; test-docker: isolated Docker test stack; test-dependencies: Redis/PostgreSQL outages; explain-messages: 10k-message query plan"
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
@@ -18,6 +19,16 @@ validate:
|
||||
test:
|
||||
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
test-docker:
|
||||
@docker compose -p mtusi2026lab2-tests -f compose.tests.yaml up -d --build --wait api; status=$$?; if [ $$status -eq 0 ]; then docker compose -p mtusi2026lab2-tests -f compose.tests.yaml run --build --rm tests; status=$$?; fi; docker compose -p mtusi2026lab2-tests -f compose.tests.yaml down -v --remove-orphans; exit $$status
|
||||
|
||||
test-dependencies:
|
||||
sh scripts/test-dependencies.sh "$(BASE_URL)" "$(COMPOSE_ENV)"
|
||||
|
||||
explain-messages:
|
||||
@docker compose --env-file "$(COMPOSE_ENV)" exec -T postgres sh -c 'psql -v ON_ERROR_STOP=1 -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"' < scripts/explain-messages.sql > evidence/explain-messages.txt
|
||||
@echo "Saved EXPLAIN output to evidence/explain-messages.txt"
|
||||
|
||||
load:
|
||||
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user