using System.Net; using Microsoft.AspNetCore.Mvc.Testing; namespace Bff.Tests; /// /// S-16c (#124): the service exposes OTel HTTP-server metrics in Prometheus text format at /metrics, /// so Prometheus can scrape the golden signals (traffic, errors, latency) for the request path. /// public class MetricsEndpointTests(WebApplicationFactory factory) : IClassFixture> { [Fact] public async Task Metrics_endpoint_exposes_http_server_request_duration_after_traffic() { var client = factory.CreateClient(); // One request produces an http.server.request.duration measurement... await client.GetAsync("/health"); // ...which the /metrics scrape endpoint then exposes in Prometheus text format. var response = await client.GetAsync("/metrics"); Assert.Equal(HttpStatusCode.OK, response.StatusCode); var body = await response.Content.ReadAsStringAsync(); Assert.Contains("http_server_request_duration", body); } }