Skip to content

Testing

Last updated: 2026-05-19 (96afca6)

  • Unit: Rust #[test] / #[tokio::test] inside crate source files
  • Integration: finstack-rs/tests/integration/ — real Postgres (Neon); two pools: finstack_app (RLS-enforced) and finstack_worker (BYPASSRLS for seeds). Never mocked.
  • E2E: Playwright (planned)
Terminal window
# Set both pool URLs
export DATABASE_URL_APP="postgres://finstack_app:<pw>@<host>/finstack"
export DATABASE_URL_WORKER="postgres://finstack_worker:<pw>@<host>/finstack"
# All integration tests
cargo test --package finstack-integration-tests
# Specific suite
cargo test --package finstack-integration-tests --test http_payment_lifecycle
cargo test --package finstack-integration-tests --test admin_provision
cargo test --package finstack-integration-tests --test refund_ledger
AreaUnitIntegration
primitive-payment✓ (FSM, serde, service)✓ (create/capture/refund)
primitive-ledger✓ (balance, reversing entry)
primitive-customer
primitive-fraud
primitive-receipt
primitive-tax
primitive-tip
primitive-split
api-rest HTTP (/v1/payments)✓ (7 tests, PR #343)
api-admin (provision, auth, keys)✓ (require_admin guard ×4, ProvisionOut serde ×1)✓ (admin.rs + admin_provision.rs)
finstack-auth
finstack-observability✓ (PR #343)
finstack-events
svc-orchestration✓ (36 unit)✓ (orchestration.rs — service layer + executor E2E with wiremock, PR #346; orchestration_e2e.rs — 4-step multi-primitive DAG)
svc-payfac✓ (derive_status_changed_at ×5, serde round-trip ×1)
svc-compliance✓ (derive_status_changed_at ×5, serde round-trip ×1)
svc-workflow
primitive-analytics✓ (fact_from_event, PR #344)✓ (analytics.rs)
primitive-inventory✓ (validate_create_item, validate_adjust_stock, PR #344)✓ (inventory.rs)
primitive-loyalty✓ (validate_earn, validate_redeem, PR #345)✓ (loyalty.rs)
svc-composer✓ (TenantConfig::empty, UpdateTenantConfig, PR #344)✓ (composer.rs)
svc-database✓ (database.rs — provision ×2, scope rejection ×3, path-validation ×3)

Seeds that bypass service methods MUST use pool_worker() (BYPASSRLS). Production-path queries MUST use pool() (RLS-enforced). See tests/integration/src/lib.rs for fresh_tenant, mint_api_key, app_router.