Add scripts/integration.sh, which starts the real FastAPI and Go API, trains small and forecast through POST /api/train, checks SSE scenario propagation, heartbeat, reconnect, then kills FastAPI to verify snapshot and last-good forecast fallback before restarting it for recovery. Add scripts/sse-load, a standard-library load generator that holds 120 concurrent SSE streams for five minutes, posts scenario changes, records p50/p95/p99 event latency, drops and heartbeat cadence, and exits non-zero when a contract threshold is missed. Add unit tests, make targets and README documentation.
29 lines
701 B
Makefile
29 lines
701 B
Makefile
GO ?= go
|
|
|
|
.PHONY: check vet test build integration integration-load load
|
|
|
|
# Local equivalent of the Gitea Actions CI job.
|
|
check: vet test build
|
|
|
|
vet:
|
|
$(GO) vet ./...
|
|
|
|
test:
|
|
$(GO) test -count=1 ./...
|
|
|
|
build:
|
|
$(GO) build ./...
|
|
|
|
# End-to-end: real FastAPI on :18000, Go on :18080, train small+forecast,
|
|
# SSE scenario/heartbeat/reconnect, FastAPI kill + cache fallback + recovery.
|
|
integration:
|
|
scripts/integration.sh
|
|
|
|
# The same run plus the 120-client, 5-minute SSE load test.
|
|
integration-load:
|
|
scripts/integration.sh --load
|
|
|
|
# Load-only against an already-running API (CONTROL_USER/CONTROL_PASS from env).
|
|
load:
|
|
$(GO) run ./scripts/sse-load -base http://127.0.0.1:18080 -clients 120 -duration 5m
|