Implement Phase 0b base project against the frozen test contract
All seven services (gateway, ledger, fraud, sanctions, insights, notifier, audit), db/schema.sql plus optional_indexes.sql, scripts/seed.py and smoke.py, the gateway-served frontend, and docker-compose.yml. Plain-text stdlib logging and a weak manual X-Request-Id only -- no observability yet, by design, per test_no_observability.py. Implements all 13 named chaos-flag pathologies from docs/PATHOLOGIES.md behind Redis-backed runtime flags. make smoke and make test-contract pass; make test-baseline and make test-pathology pass except for a handful of load-sensitive tests documented in tests/README.md rather than papered over.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# Ledgerline -- application targets (phase-0-base-project-spec.md §12) plus
|
||||
# the Phase 0a test-suite targets. `make up && make seed` are prerequisites
|
||||
# for every test target below.
|
||||
|
||||
PYTEST ?= pytest
|
||||
COMPOSE ?= docker compose
|
||||
SEED_DSN ?= postgresql://ledgerline:ledgerline@postgres:5432/ledgerline
|
||||
GATEWAY_URL ?= http://localhost:8000
|
||||
|
||||
.PHONY: up down logs seed reset smoke \
|
||||
chaos-clean chaos-light chaos-nightmare chaos-random \
|
||||
fix-index drop-index \
|
||||
test test-contract test-baseline test-pathology test-slow test-all
|
||||
|
||||
up:
|
||||
$(COMPOSE) up -d --build
|
||||
|
||||
down:
|
||||
$(COMPOSE) down
|
||||
|
||||
logs:
|
||||
$(COMPOSE) logs -f
|
||||
|
||||
seed:
|
||||
cat db/schema.sql | $(COMPOSE) exec -T postgres psql -U ledgerline -d ledgerline
|
||||
$(COMPOSE) run --rm -e POSTGRES_DSN=$(SEED_DSN) gateway python scripts/seed.py
|
||||
|
||||
reset:
|
||||
$(COMPOSE) down -v
|
||||
$(MAKE) up
|
||||
$(MAKE) seed
|
||||
|
||||
smoke:
|
||||
$(COMPOSE) run --rm -e POSTGRES_DSN=$(SEED_DSN) -e GATEWAY_URL=http://gateway:8000 gateway python scripts/smoke.py
|
||||
|
||||
chaos-clean:
|
||||
curl -sf -X POST $(GATEWAY_URL)/api/admin/chaos/profile -H 'Content-Type: application/json' -d '{"profile":"clean"}'
|
||||
|
||||
chaos-light:
|
||||
curl -sf -X POST $(GATEWAY_URL)/api/admin/chaos/profile -H 'Content-Type: application/json' -d '{"profile":"light"}'
|
||||
|
||||
chaos-nightmare:
|
||||
curl -sf -X POST $(GATEWAY_URL)/api/admin/chaos/profile -H 'Content-Type: application/json' -d '{"profile":"nightmare"}'
|
||||
|
||||
chaos-random:
|
||||
curl -sf -X POST $(GATEWAY_URL)/api/admin/chaos/profile -H 'Content-Type: application/json' -d '{"profile":"random"}'
|
||||
|
||||
fix-index:
|
||||
cat db/optional_indexes.sql | $(COMPOSE) exec -T postgres psql -U ledgerline -d ledgerline
|
||||
|
||||
drop-index:
|
||||
cat db/drop_indexes.sql | $(COMPOSE) exec -T postgres psql -U ledgerline -d ledgerline
|
||||
|
||||
test:
|
||||
$(PYTEST) -m "not slow"
|
||||
|
||||
test-contract:
|
||||
$(PYTEST) -m "contract or seed or guard"
|
||||
|
||||
test-baseline:
|
||||
$(PYTEST) -m baseline
|
||||
|
||||
test-pathology:
|
||||
$(PYTEST) -m "pathology and not slow"
|
||||
|
||||
test-slow:
|
||||
$(PYTEST) -m slow
|
||||
|
||||
test-all:
|
||||
$(PYTEST)
|
||||
Reference in New Issue
Block a user