forked from mtusi2026/mtusi2026lab2
Добавить Dockerfile и compose с PostgreSQL и Redis
This commit is contained in:
@@ -2,9 +2,10 @@ PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
COMPOSE = docker compose --env-file .env
|
||||
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 env up down clean student-test test-failures explain
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@@ -24,3 +25,27 @@ 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)
|
||||
|
||||
env:
|
||||
./scripts/init-env.sh
|
||||
|
||||
up: env
|
||||
$(COMPOSE) up -d --build
|
||||
BASE_URL="$(BASE_URL)" ./scripts/wait-ready.sh
|
||||
|
||||
down:
|
||||
$(COMPOSE) --profile test down
|
||||
|
||||
# удаляет контейнеры вместе с данными PostgreSQL и Redis
|
||||
clean:
|
||||
$(COMPOSE) --profile test down -v
|
||||
|
||||
student-test:
|
||||
BASE_URL="$(BASE_URL)" $(PYTHON) -m unittest discover -s student-tests -v
|
||||
|
||||
# останавливает и запускает redis/postgres, поднимает второй API на порту 8081
|
||||
test-failures:
|
||||
BASE_URL="$(BASE_URL)" $(PYTHON) -m unittest discover -s student-tests/failures -v
|
||||
|
||||
explain:
|
||||
./scripts/explain_history.sh
|
||||
|
||||
Reference in New Issue
Block a user