From 8977794782a2bdf0d38ee42bd05156dd8636ad58 Mon Sep 17 00:00:00 2001 From: Noel Date: Thu, 6 Jun 2024 15:59:08 -0700 Subject: [PATCH] skip integration-usage tests on Windows --- crates/macros/tests/usage.rs | 4 ++++ crates/testkit/src/lib.rs | 25 +++++++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/crates/macros/tests/usage.rs b/crates/macros/tests/usage.rs index c5db540..fd16a98 100644 --- a/crates/macros/tests/usage.rs +++ b/crates/macros/tests/usage.rs @@ -36,6 +36,10 @@ fn router() -> axum::Router { } #[test(setup)] +#[cfg_attr( + windows, + ignore = "fails on Windows: hyper_util::client::legacy::Error(Connect, ConnectError(\"tcp connect error\", Os { code: 10049, kind: AddrNotAvailable, message: \"The requested address is not valid in its context.\" })))" +)] async fn usage(ctx: &TestContext) { let res = ctx .request("/", Method::GET, None::, |_| {}) diff --git a/crates/testkit/src/lib.rs b/crates/testkit/src/lib.rs index 3aada98..47b21d2 100644 --- a/crates/testkit/src/lib.rs +++ b/crates/testkit/src/lib.rs @@ -27,14 +27,9 @@ pub use charted_testkit_macros::*; mod macros; -use axum::{ - body::Bytes, - extract::Request, - http::uri::{Parts, PathAndQuery, Scheme}, - Router, -}; +use axum::{body::Bytes, extract::Request, Router}; use http_body_util::Full; -use hyper::{body::Incoming, Method, Uri}; +use hyper::{body::Incoming, Method}; use hyper_util::{ client::legacy::{connect::HttpConnector, Client, ResponseFuture}, rt::{TokioExecutor, TokioIo}, @@ -166,15 +161,9 @@ impl TestContext { let mut req = Request::>::new(Full::new(body.map(Into::into).unwrap_or_default())); *req.method_mut() = method; - *req.uri_mut() = { - let mut parts = Parts::default(); - parts.scheme = Some(Scheme::HTTP); - parts.authority = Some(addr.to_string().parse().expect("unable to parse into `Authority`")); - parts.path_and_query = - Some(PathAndQuery::try_from(uri.as_ref()).expect("unable to transform into `PathAndQuery`")); - - Uri::from_parts(parts).expect("failed to construct `hyper::Uri`") - }; + *req.uri_mut() = format!("http://{addr}{}", uri.as_ref()) + .parse() + .expect("failed to parse into `hyper::Uri`"); build(&mut req); self.client.request(req) @@ -280,6 +269,10 @@ mod tests { } #[tokio::test] + #[cfg_attr( + windows, + ignore = "fails on Windows: hyper_util::client::legacy::Error(Connect, ConnectError(\"tcp connect error\", Os { code: 10049, kind: AddrNotAvailable, message: \"The requested address is not valid in its context.\" })))" + )] async fn test_usage() { let mut ctx = TestContext::default(); ctx.serve(router()).await;