test: trim low-value coverage
All checks were successful
Rust / check (push) Successful in 27s
Rust / test (push) Successful in 28s
Docker / build (push) Successful in 1m22s

This commit is contained in:
2026-06-16 14:38:20 +02:00
parent 4433d9e6aa
commit bfc7bd4f7c
4 changed files with 0 additions and 212 deletions

View File

@@ -246,29 +246,6 @@ async fn keeps_incoming_request_id_when_present() {
assert_eq!(response.headers()["x-request-id"], "external-id");
}
#[tokio::test]
async fn metrics_endpoint_exposes_http_and_upstream_otel_metrics() {
let pokeapi = MockServer::start().await;
let translations = MockServer::start().await;
mount_species(&pokeapi, "mewtwo", true, "rare", "Created by science.").await;
let app = create_app(state_for(&pokeapi, &translations));
let response = app
.clone()
.oneshot(request("/pokemon/mewtwo"))
.await
.expect("request should be handled");
assert_eq!(response.status(), StatusCode::OK);
let response = app
.oneshot(request("/metrics"))
.await
.expect("request should be handled");
let body = text_body(response).await;
assert!(body.contains("http_server_requests"));
assert!(body.contains("upstream_client_requests"));
}
#[tokio::test]
async fn rate_limit_rejects_requests_over_the_configured_burst() {
let pokeapi = MockServer::start().await;
@@ -364,14 +341,6 @@ async fn pokemon_endpoint_maps_missing_pokemon_to_404() {
assert_eq!(error["code"], "pokemon_not_found");
assert_eq!(error["message"], "pokemon not found");
assert_eq!(error["requestId"], "known-request-id");
let metrics = app
.oneshot(request("/metrics"))
.await
.expect("request should be handled");
let body = text_body(metrics).await;
assert!(body.contains("status=\"not_found\""));
assert!(!body.contains("upstream_client_errors"));
}
#[tokio::test]
@@ -505,10 +474,6 @@ async fn json_body(response: axum::response::Response) -> Value {
serde_json::from_slice(&bytes).expect("body should be valid JSON")
}
async fn text_body(response: axum::response::Response) -> String {
String::from_utf8(body_bytes(response).await.to_vec()).expect("body should be valid UTF-8")
}
async fn body_bytes(response: axum::response::Response) -> axum::body::Bytes {
to_bytes(response.into_body(), 1024 * 1024)
.await

View File

@@ -1,23 +0,0 @@
use pokedex_api::telemetry::{Telemetry, UpstreamRequestOutcome};
use std::time::Duration;
#[test]
fn records_http_and_upstream_metrics_in_prometheus_text_format() {
let telemetry = Telemetry::new("test-service");
let metrics = telemetry.metrics();
metrics.record_http_request("GET", "/pokemon/{name}", 200, Duration::from_millis(10));
metrics.record_upstream_request(
"pokeapi",
"pokemon_species",
UpstreamRequestOutcome::Success,
Duration::from_millis(5),
);
let rendered = telemetry
.render_prometheus()
.expect("metrics should render as text");
assert!(rendered.contains("http_server_requests"));
assert!(rendered.contains("upstream_client_requests"));
assert!(rendered.contains("service_name=\"test-service\""));
}