Skip to content

Commit

Permalink
tests: use a documented test network for testing
Browse files Browse the repository at this point in the history
10.255.255.0/24 is part of 10.0.0.0/8 and reserved for "Private Use" by
IANA [1]. That means that those IP might be in use in some internal
networks, making the timeout tests to fail on those networks.
One example of such network is the Ubuntu testing infrastructure.

Changing for a documented "Test network", that is supposed to never be
routable [2] makes the tests to have a better chance to pass in most
network contexts.

[1]: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
[2]: https://www.rfc-editor.org/rfc/rfc5737.html
  • Loading branch information
Hyask authored and seanmonstar committed Sep 12, 2024
1 parent 964b1c6 commit c8665be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/timeouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async fn connect_timeout() {
.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 @@ -100,7 +100,7 @@ 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()
Expand All @@ -126,8 +126,8 @@ 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))
Expand Down

0 comments on commit c8665be

Please sign in to comment.