Testing
make test # pytest
make lint # ruff
python -m pytest --cov=relational_transformers_gateway --cov-report=term-missing
The suite holds coverage at ~94% with no AWS access and no mock patching of
boto3: every AWS client is a constructor argument, and the tests inject
small fakes (tests/conftest.py). Three layers:
Unit — config parsing, auth caching, rate limiting, discovery fallbacks, LLM body validation, usage extraction, the manage CLI against fake clients.
Core —
Gateway.handleend to end with fake AWS: auth failures, rate limits, 404/405/413, metering-failure 503s, duplicate-id 409s,/v1/modelsfiltering.Real sockets — the actual
ThreadingHTTPServeragainst stub worker and stub OpenAI servers on loopback: forward proxying with retry past a dead worker, SSE streaming with usage metering, malformedcontent-length, oversized bodies, SIGTERM shutdown.
Live wiring test
For an end-to-end check against real AWS and a real GPU box:
Start
scripts/vast-test-worker.shon the box (serves/healthand a/v1/forwardstub on :8500).Tunnel it locally (
ssh -N -L 8500:localhost:8500 ...) and registerhttp://127.0.0.1:8500withrtg-manage register-worker.Run
rtg-servewith the real environment and exercise/gateway/health,/health,/v1/forward, a duplicatex-request-id(expect 409), andrtg-manage revoke-key(expect 401 within the auth cache window).Clean up: deregister the worker, delete the test key, and remove the test rows from the usage table.
This flow was last validated 2026-08-04 against a Vast RTX 5070.