-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
Write a comprehensive integration test suite for all HTTP endpoints in the Rust service. Tests must spin up a real Axum server and make actual HTTP requests using a test client, with mocked Stellar and Redis backends.
Requirements:
- Use
axum-testortower::ServiceExtto create a test router without binding to a port - Create test fixtures and helpers:
test_app()— builds the full Axum router with mockedStellarClientand in-memory statemock_stellar_verify(hash, verified)— configures the mock to return a given resultvalid_sha256()— helper that returns a random valid SHA-256 hex string
- Write integration tests for every endpoint:
GET /health→ 200GET /metrics→ 200 with Prometheus contentPOST /verify— valid hash → 200; invalid hash → 400; Stellar failure → 500GET /verify/:hash— same as above via GETPOST /verify/batch— valid batch; too many hashes → 400; empty → 400GET /verify/:hash/history— found; not found → 404POST /submit— valid submission; missing secret key → appropriate errorPOST /revoke— existing hash; non-existent hash → 404POST /transfer— valid; invalid date → 400
- All tests must be independent (no shared state between tests)
Acceptance Criteria:
- All endpoint tests pass with
cargo test - No tests share mutable state
- Test coverage includes both happy path and error cases for every endpoint
- Tests run without any external services (no real Redis, no real Stellar)
Reactions are currently unavailable