forked from mtusi2026/mtusi2026lab2
refactor: update project structure
This commit is contained in:
@@ -1,26 +1,47 @@
|
||||
PYTHON ?= python3
|
||||
BASE_URL ?= http://localhost:8080
|
||||
CA_FILE ?=
|
||||
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 app-up app-down app-logs check validate test test-backend load test-persistence
|
||||
|
||||
help:
|
||||
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
||||
@echo "app-up: build and start API, database and frontend (http://localhost:5173)"
|
||||
@echo "app-down: stop the application and keep PostgreSQL data"
|
||||
@echo "app-logs: follow service logs"
|
||||
@echo "check: offline contract structure"
|
||||
@echo "validate: full OpenAPI validation (install requirements-dev.txt first)"
|
||||
@echo "test: public API smoke test (run app-up first)"
|
||||
@echo "test-backend: Go tests with PostgreSQL and race detection in isolated schemas"
|
||||
@echo "test-persistence ACTION_SCRIPT=scripts/restart.sh: restart API and DB, verify saved data and session (run app-up first)"
|
||||
@echo "load: synthetic API writes"
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
app-up:
|
||||
$(COMPOSE) up -d --build --wait
|
||||
|
||||
validate:
|
||||
$(PYTHON) scripts/validate_openapi.py
|
||||
app-down:
|
||||
$(COMPOSE) down
|
||||
|
||||
app-logs:
|
||||
$(COMPOSE) logs -f
|
||||
|
||||
check:
|
||||
$(PYTHON) scripts/check_contract.py
|
||||
|
||||
validate:
|
||||
$(PYTHON) scripts/validate_openapi.py
|
||||
|
||||
test:
|
||||
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
load:
|
||||
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
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)
|
||||
test-backend:
|
||||
$(COMPOSE) --profile test run --build --rm backend-tests
|
||||
|
||||
load:
|
||||
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user