Skip to content

Testing

Run unit tests for all internal packages:

Terminal window
go test ./internal/... -v -timeout 5m -coverprofile=cover.out

Tests use pgxmock for database mocking and testify for assertions. Each package follows table-driven test patterns.

Integration tests require a real PostgreSQL and Redis instance (provided by Docker in local dev). Run them with the integration build tag:

Terminal window
go test -tags=integration ./internal/... -v -timeout 5m
Terminal window
go test ./... -v -timeout 5m -count=1

Integration tests use the same build tag:

Terminal window
go test -tags=integration ./... -v -timeout 5m

The dashboard uses Vitest with jsdom for unit and component tests:

Terminal window
# Watch mode
pnpm test
# Coverage report (lcov)
pnpm test:coverage

E2E tests use Playwright with Chromium. They require the API server to be running and a preview build of the dashboard:

Terminal window
pnpm test:e2e

Tests run in this order on every push:

  1. Lint (golangci-lint, ESLint)
  2. Unit tests (Go + Vitest)
  3. Build (Docker image + dashboard)
  4. Integration tests (Go with Postgres/Redis service containers)
  5. E2E tests (Playwright)

All CI jobs run on self-hosted runners with PostgreSQL and Redis available as service containers.

  • Registry compatibility — runs on a schedule to verify rule pack compatibility with the current engine
  • Nightly E2E — a separate workflow runs the full Playwright suite against a staging-like environment