Skip to content

Expand monitoring API test coverage (unit + integration) #329

@gimballock

Description

@gimballock

Context

PR #281 introduced monitoring integration tests that validate the /metrics (Prometheus) and /api/v1/health endpoints. A reviewer noted that the JSON REST API endpoints are only covered by unit tests in http_server.rs but lack integration-level validation against a running topology.

Goal

Extend test coverage to exercise the full JSON REST API surface in both unit tests and integration tests, ensuring the responses contain correct, meaningful data from live SV2 topologies.

Endpoints needing integration tests

All JSON API endpoints (/, /api/v1/global, /api/v1/server, /api/v1/server/channels, /api/v1/clients, /api/v1/clients/{id}, /api/v1/clients/{id}/channels, /api/v1/sv1/clients, /api/v1/sv1/clients/{id}) currently have unit tests only. /api/v1/health and /metrics are already covered by integration tests.

Suggested approach

  1. Add integration tests to monitoring_integration.rs that reuse existing topology setups and make HTTP requests to each JSON endpoint, asserting on status codes and key fields.
  2. Add assertion helpers to prometheus_metrics_assertions.rs for JSON API responses.
  3. Strengthen unit tests in http_server.rs to cover edge cases (pagination boundaries, invalid path params, partial data sources).

Acceptance criteria

  • Every JSON API endpoint has at least one integration test against a live topology
  • Unit tests cover error/edge cases for pagination and missing data
  • All existing tests continue to pass
  • cargo fmt, cargo clippy -D warnings clean

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo 📝

    Status

    Todo 📝

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions