Skip to content

Commit

Permalink
remove ununsed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Jan 15, 2024
1 parent ceff93d commit 2a98dc4
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions src/middleware/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,75 +134,3 @@ fn http_route<B>(req: &Request<B>) -> &str {
.get::<MatchedPath>()
.map_or_else(|| "", |mp| mp.as_str())
}

// #[cfg(test)]
// mod tests {
// use super::*;
// use axum::{body::Body, routing::get, Router};
// use http::{Request, StatusCode};
// use rstest::rstest;
// use testing_tracing_opentelemetry::{assert_trace, FakeEnvironment};
// use tower::Service;

// #[rstest]
// #[case("filled_http_route_for_existing_route", "http://example.com/users/123", &[], false)]
// #[case("empty_http_route_for_nonexisting_route", "/idontexist/123", &[], false)]
// #[case("status_code_on_close_for_ok", "/users/123", &[], false)]
// #[case("status_code_on_close_for_error", "/status/500", &[], false)]
// #[case("filled_http_headers", "/users/123", &[("user-agent", "tests"), ("x-forwarded-for", "127.0.0.1")], false)]
// #[case("call_with_w3c_trace", "/users/123", &[("traceparent", "00-b2611246a58fd7ea623d2264c5a1e226-b2c9b811f2f424af-01")], true)]
// #[case("trace_id_in_child_span", "/with_child_span", &[], false)]
// #[case("trace_id_in_child_span_for_remote", "/with_child_span", &[("traceparent", "00-b2611246a58fd7ea623d2264c5a1e226-b2c9b811f2f424af-01")], true)]
// // failed to extract "http.route" before axum-0.6.15
// // - https://github.com/davidB/axum-tracing-opentelemetry/pull/54 (reverted)
// // - https://github.com/tokio-rs/axum/issues/1441#issuecomment-1272158039
// #[case("extract_route_from_nested", "/nest/123", &[], false)]
// #[tokio::test(flavor = "multi_thread")]
// async fn check_span_event(
// #[case] name: &str,
// #[case] uri: &str,
// #[case] headers: &[(&str, &str)],
// #[case] is_trace_id_constant: bool,
// ) {
// let fake_env = FakeEnvironment::setup().await;
// {
// let mut svc = Router::new()
// .route("/users/:id", get(|| async { StatusCode::OK }))
// .route(
// "/status/500",
// get(|| async { StatusCode::INTERNAL_SERVER_ERROR }),
// )
// .route(
// "/with_child_span",
// get(|| async {
// let span = tracing::span!(tracing::Level::INFO, "my child span");
// span.in_scope(|| {
// // Any trace events in this closure or code called by it will occur within
// // the span.
// });
// StatusCode::OK
// }),
// )
// .nest(
// "/nest",
// Router::new()
// .route("/:nest_id", get(|| async {}))
// .fallback(|| async { (StatusCode::NOT_FOUND, "inner fallback") }),
// )
// .fallback(|| async { (StatusCode::NOT_FOUND, "outer fallback") })
// .layer(OtelAxumLayer::default());
// let mut builder = Request::builder();
// for (key, value) in headers {
// builder = builder.header(*key, *value);
// }
// let req = builder.uri(uri).body(Body::empty()).unwrap();
// let _res = svc.call(req).await.unwrap();

// // while res.data().await.is_some() {}
// // res.trailers().await.unwrap();
// // drop(res);
// }
// let (tracing_events, otel_spans) = fake_env.collect_traces().await;
// assert_trace(name, tracing_events, otel_spans, is_trace_id_constant);
// }
// }

0 comments on commit 2a98dc4

Please sign in to comment.