Skip to content

[CT-25] Write integration tests for GET /metrics #557

@mftee

Description

@mftee

Problem

The /metrics endpoint exposes Prometheus counters for requests, cache hits, cache misses, and errors but has no test coverage. Regressions in metric instrumentation would silently produce incorrect monitoring data.

Proposed Solution

Write integration tests for the metrics endpoint inside contract/module/tests/metrics_tests.rs.

Acceptance Criteria

  • Test: GET /metrics returns 200 with a response body in Prometheus text exposition format
  • Test: after making one POST /verify request the request_count metric in the /metrics response has incremented by 1
  • Test: after a cache hit on /verify the cache_hits_total counter has incremented
  • Test: after a cache miss on /verify the cache_misses_total counter has incremented
  • Test: after a failed Stellar query (mock error) the error_count metric has incremented
  • Tests use axum-test to make requests against a test app instance with mocked StellarClient and CacheBackend
  • All test files live inside contract/module/tests/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    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