Skip to content

Commit 892569e

Browse files
schopin-proseanmonstar
authored andcommitted
tests: bypass the proxy if testing DNS override
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.
1 parent c4ebb07 commit 892569e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ async fn overridden_dns_resolution_with_gai() {
246246
server.addr().port()
247247
);
248248
let client = reqwest::Client::builder()
249+
.no_proxy()
249250
.resolve(overridden_domain, server.addr())
250251
.build()
251252
.expect("client builder");
@@ -270,6 +271,7 @@ async fn overridden_dns_resolution_with_gai_multiple() {
270271
// the server runs on IPv4 localhost, so provide both IPv4 and IPv6 and let the happy eyeballs
271272
// algorithm decide which address to use.
272273
let client = reqwest::Client::builder()
274+
.no_proxy()
273275
.resolve_to_addrs(
274276
overridden_domain,
275277
&[
@@ -302,6 +304,7 @@ async fn overridden_dns_resolution_with_hickory_dns() {
302304
server.addr().port()
303305
);
304306
let client = reqwest::Client::builder()
307+
.no_proxy()
305308
.resolve(overridden_domain, server.addr())
306309
.hickory_dns(true)
307310
.build()
@@ -328,6 +331,7 @@ async fn overridden_dns_resolution_with_hickory_dns_multiple() {
328331
// the server runs on IPv4 localhost, so provide both IPv4 and IPv6 and let the happy eyeballs
329332
// algorithm decide which address to use.
330333
let client = reqwest::Client::builder()
334+
.no_proxy()
331335
.resolve_to_addrs(
332336
overridden_domain,
333337
&[

0 commit comments

Comments
 (0)