Skip to content

Add integration test coverage for admin endpoints including pause, DLQ, and API-key routes #245

@Jagadeeshftw

Description

@Jagadeeshftw

Description

The 49-file vitest suite covers stream CRUD and middleware but has sparse coverage of the admin route surface in src/routes/admin.ts. Routes for pause flags (GET/PUT /api/admin/pause), read-only mode (GET /api/admin/status/read-only), DLQ management, API-key lifecycle, and reindex operations lack dedicated integration tests. Full coverage of these routes is critical since they control operational state of the running service.

Requirements and context

  • Add tests for all admin route permutations: pause enable/disable, read-only mode toggle, DLQ list/delete, API-key create/list/delete, and admin status
  • Test both operator (authorised) and viewer/unauthenticated (forbidden) paths for every route
  • Use supertest with an in-process Express app and a seeded test database
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested execution

Fork the repo and create a branch

git checkout -b feature/admin-endpoint-test-coverage

Implement changes

  • Update/Write: tests/routes/admin.pause.test.ts — pause and read-only mode tests
  • Update/Write: tests/routes/admin.dlq.test.ts — DLQ CRUD tests
  • Update/Write: tests/routes/admin.apiKeys.test.ts — API-key lifecycle tests
  • Update/Write: tests/fixtures/adminSeeds.ts — shared database seed helpers for admin tests
  • Add documentation: docs/testing.md — document admin test setup and fixture patterns
  • Include clear code comments and types
  • Validate security assumptions

Test and commit

  • Run tests: pnpm test (or pnpm test:coverage)
  • Cover edge cases: concurrent pause toggle, delete non-existent DLQ entry, create API key with duplicate name, reindex while pause is active
  • Include test output and security notes

Example commit message

test: add comprehensive integration coverage for admin endpoints

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programapiHTTP/WebSocket APIbackendBackend service worktestingTests and coverage

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions