Skip to content

[Testing] Admin indexer routes /v1/admin/indexer/{status,reset,replay} have no route-level test #847

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Labels: backend, testing, Stellar Wave

The admin indexer routes have no route-level test, so their auth and validation go unverified.

tests/integration/admin-metrics.test.ts mocks indexerService and only hits GET /metrics. The handlers in admin.routes.ts:176-249 (status, reset, replay), including the check that a missing or negative ledger returns 400 and that reset/replay return ok/202, are never driven through the router. That leaves auth, validation and status codes on these operational endpoints untested.

What the fix has to hold to

  • the tests go through the actual router, not around it
  • auth (requireAdmin), validation and status codes are all asserted

Done when

  • integration tests added for GET /status, POST /reset, POST /replay
  • asserts 400 for negative/non-integer ledger, 202 for a valid replay, and that requireAdmin is enforced
  • asserts resetIndexer/replayFromLedger are called with the parsed values
  • tests + CI green

Where to start
backend/tests/integration/admin-metrics.test.ts, referencing backend/src/routes/v1/admin.routes.ts. Re-testing the metrics aggregation that's already covered is out of scope. Follow the existing mock setup in that file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Stellar WaveIssues in the Stellar wave programbackendBackend related taskstestingTesting related tasks

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions