Files
galaxy-game/integration
2026-04-09 15:27:14 +02:00
..
2026-04-09 15:27:14 +02:00
2026-04-09 15:27:14 +02:00
2026-04-09 15:27:14 +02:00
2026-04-09 15:27:14 +02:00

Integration Tests

integration owns only true inter-service black-box tests. Each suite must raise real service processes, speak only over public HTTP/gRPC/Redis contracts, and avoid imports from internal/... packages of tested services.

Layout

integration/
├── README.md
├── go.mod
├── gatewayauthsession/
│   ├── harness_test.go
│   └── gateway_authsession_test.go
└── internal/
    ├── contracts/
    │   └── gatewayv1/
    │       └── contract.go
    └── harness/
        ├── binary.go
        ├── keys.go
        ├── mail_stub.go
        ├── process.go
        └── user_stub.go

Rules

  • Keep suites black-box. Do not import galaxy/gateway/internal/..., galaxy/authsession/internal/..., or any other service-owned internal package.
  • Start real binaries from cmd/... and talk to them only through their published HTTP, gRPC, and Redis contracts.
  • Put boundary-specific orchestration and assertions into the owning suite package, not into shared helpers.
  • Put only generic process/runtime utilities into internal/harness.
  • Put only public-contract helpers into internal/contracts/....

Current Boundary Suites

  • gatewayauthsession verifies the integration boundary between real Edge Gateway and real Auth / Session Service.

The current fast suite uses one isolated miniredis instance plus external stateful HTTP stubs for mail and user services.

Running

Run from the module directory:

cd integration
go test ./gatewayauthsession/...

Useful regression commands after boundary changes:

go test ./gatewayauthsession/...
cd ../gateway && go test ./...
cd ../authsession && go test ./... -run GatewayCompatibility

Do not use go test ./... from the repository root. The repository is organized through go.work, so verification should stay module-scoped.

Adding A New Boundary Suite

  1. Create integration/<boundary>/ for the new inter-service boundary.
  2. Keep suite-local fixtures, scenario helpers, and assertion helpers inside that package.
  3. Reuse internal/harness only for generic concerns such as binary build/run, ports, keys, Redis, and shared external stubs.
  4. Add new helpers to internal/contracts/<contract>/ only when they describe a reusable public wire contract.
  5. Prefer fast deterministic infrastructure by default: in-memory test doubles, httptest stubs, and miniredis.

Future Real Redis Smoke Suites

Fast suites stay on miniredis by default. When a boundary needs one real Redis smoke suite later, keep it in the same boundary package and gate it explicitly with environment-driven configuration such as INTEGRATION_REAL_REDIS_ADDR. That smoke suite should complement, not replace, the deterministic miniredis coverage.