This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
PYTHON ?= $(if $(wildcard .venv/bin/python),.venv/bin/python,python3)
|
||||
GO ?= go
|
||||
PORT ?= 8080
|
||||
BASE_URL ?= http://localhost:8080
|
||||
IMAGE ?= mtusi-messenger:lab1
|
||||
BASE_URL ?= http://localhost:$(PORT)
|
||||
IMAGE ?= mtusi-messenger:lab2
|
||||
CA_FILE ?=
|
||||
ACTION_SCRIPT ?=
|
||||
ACTION_SCRIPT ?= scripts/restart.sh
|
||||
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
||||
|
||||
.PHONY: help run docker-build docker-run check validate test test-own test-all load test-persistence
|
||||
.PHONY: help run docker-build docker-run check validate test test-own test-all load test-persistence bootstrap up down migrate test-integration test-grade4 measure-load migrate-status migrate-down
|
||||
|
||||
export PORT BASE_URL
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@echo "up: start Compose stack; down: stop with volumes retained; test-integration: PostgreSQL race/rollback/EXPLAIN; test-grade4: auth/expiry/outages; check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
@@ -32,3 +34,36 @@ 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)
|
||||
|
||||
bootstrap:
|
||||
./scripts/bootstrap.sh
|
||||
|
||||
up: bootstrap
|
||||
./scripts/compose.sh up -d --build --wait
|
||||
|
||||
down:
|
||||
./scripts/compose.sh down
|
||||
|
||||
migrate: bootstrap
|
||||
./scripts/compose.sh run --build --rm migrations up
|
||||
|
||||
migrate-status:
|
||||
./scripts/compose.sh run --rm migrations status
|
||||
|
||||
migrate-down:
|
||||
./scripts/compose.sh run --rm migrations down
|
||||
|
||||
run:
|
||||
PORT="$(PORT)" $(GO) run ./cmd
|
||||
|
||||
docker-build:
|
||||
docker build -t "$(IMAGE)" .
|
||||
|
||||
test-integration:
|
||||
./scripts/compose.sh run --build --rm tests
|
||||
|
||||
test-grade4:
|
||||
$(PYTHON) tests/own/grade4.py
|
||||
|
||||
measure-load:
|
||||
$(PYTHON) scripts/measure_load.py --base-url "$(BASE_URL)"
|
||||
|
||||
Reference in New Issue
Block a user