Skip to content

Add integration test suite with real Postgres and Redis #20

@haasonsaas

Description

@haasonsaas

Summary

All tests use in-memory stores or mocks. There are no integration tests that exercise the real Postgres repository or Redis runtime store, or that test end-to-end flows through the full stack.

Current state

  • Postgres repository tested with pgxmock (SQL-level mocking)
  • Redis runtime store tested with miniredis
  • No test exercises the real Postgres query planner, transaction behavior, or constraint enforcement
  • No end-to-end test: session creation → grant request → approval → proxy execution → revocation
  • No test for cleanup worker against real persistence

Required work

  • Add testcontainers-based integration tests for Postgres repository (real Postgres instance, apply migrations, run full CRUD)
  • Add testcontainers-based integration tests for Redis runtime store (real Redis instance, test budget enforcement under concurrency)
  • Add end-to-end integration test: full flow from session creation through grant issuance to proxy execution and cleanup
  • Add concurrent access tests: multiple goroutines issuing grants, executing proxies, and revoking sessions simultaneously
  • Tag integration tests with //go:build integration so they don't run in basic CI (add a separate CI job for integration tests)
  • Add load test for budget enforcement: many concurrent proxy requests against a single handle

Files

  • New test files in internal/store/postgres/, internal/store/redis/, internal/app/
  • .github/workflows/ci.yml — add integration test job with Postgres and Redis services

Priority

Low-medium — mocks cover logic but miss real database behavior.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions