Skip to content

Commit

Permalink
tests: bypass the proxy if testing DNS override
Browse files Browse the repository at this point in the history
If an explicit proxy is configured in the environment, then the request
will go through it rather than actually resolving the domain. Either
we're hitting the target domain on a weird port which will likely fail,
or the proxy straight up denies that weird request.

We're hitting this issue in the Ubuntu CI. Amazingly enough, the tests
actually passed *once* there, although the exact circumstances that
allowed this are still a bit of a mystery.
  • Loading branch information
schopin-pro authored and seanmonstar committed Jul 3, 2024
1 parent c4ebb07 commit 892569e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ async fn overridden_dns_resolution_with_gai() {
server.addr().port()
);
let client = reqwest::Client::builder()
.no_proxy()
.resolve(overridden_domain, server.addr())
.build()
.expect("client builder");
Expand All @@ -270,6 +271,7 @@ async fn overridden_dns_resolution_with_gai_multiple() {
// the server runs on IPv4 localhost, so provide both IPv4 and IPv6 and let the happy eyeballs
// algorithm decide which address to use.
let client = reqwest::Client::builder()
.no_proxy()
.resolve_to_addrs(
overridden_domain,
&[
Expand Down Expand Up @@ -302,6 +304,7 @@ async fn overridden_dns_resolution_with_hickory_dns() {
server.addr().port()
);
let client = reqwest::Client::builder()
.no_proxy()
.resolve(overridden_domain, server.addr())
.hickory_dns(true)
.build()
Expand All @@ -328,6 +331,7 @@ async fn overridden_dns_resolution_with_hickory_dns_multiple() {
// the server runs on IPv4 localhost, so provide both IPv4 and IPv6 and let the happy eyeballs
// algorithm decide which address to use.
let client = reqwest::Client::builder()
.no_proxy()
.resolve_to_addrs(
overridden_domain,
&[
Expand Down

0 comments on commit 892569e

Please sign in to comment.