Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeout testing #2418

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions tests/timeouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async fn client_timeout() {

let client = reqwest::Client::builder()
.timeout(Duration::from_millis(100))
.no_proxy()
.build()
.unwrap();

Expand All @@ -44,7 +45,7 @@ async fn request_timeout() {
}
});

let client = reqwest::Client::builder().build().unwrap();
let client = reqwest::Client::builder().no_proxy().build().unwrap();

let url = format!("http://{}/slow", server.addr());

Expand All @@ -71,10 +72,11 @@ async fn connect_timeout() {

let client = reqwest::Client::builder()
.connect_timeout(Duration::from_millis(100))
.no_proxy()
.build()
.unwrap();

let url = "http://10.255.255.1:81/slow";
let url = "http://192.0.2.1:81/slow";

let res = client
.get(url)
Expand All @@ -98,9 +100,10 @@ async fn connect_many_timeout_succeeds() {
let client = reqwest::Client::builder()
.resolve_to_addrs(
"many_addrs",
&["10.255.255.1:81".parse().unwrap(), server.addr()],
&["192.0.2.1:81".parse().unwrap(), server.addr()],
)
.connect_timeout(Duration::from_millis(100))
.no_proxy()
.build()
.unwrap();

Expand All @@ -123,11 +126,12 @@ async fn connect_many_timeout() {
.resolve_to_addrs(
"many_addrs",
&[
"10.255.255.1:81".parse().unwrap(),
"10.255.255.2:81".parse().unwrap(),
"192.0.2.1:81".parse().unwrap(),
"192.0.2.2:81".parse().unwrap(),
],
)
.connect_timeout(Duration::from_millis(100))
.no_proxy()
.build()
.unwrap();

Expand Down Expand Up @@ -190,6 +194,7 @@ async fn read_timeout_applies_to_headers() {

let client = reqwest::Client::builder()
.read_timeout(Duration::from_millis(100))
.no_proxy()
.build()
.unwrap();

Expand Down Expand Up @@ -410,7 +415,7 @@ async fn response_body_timeout_forwards_size_hint() {

let server = server::http(move |_req| async { http::Response::new(b"hello".to_vec().into()) });

let client = reqwest::Client::new();
let client = reqwest::Client::builder().no_proxy().build().unwrap();

let url = format!("http://{}/slow", server.addr());

Expand Down