Skip to content

Commit 31639a0

Browse files
committed
solana-client tests to use dedicated port ranges
1 parent f7f2f5f commit 31639a0

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-test/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ edition = { workspace = true }
1212

1313
[dependencies]
1414
futures-util = { workspace = true }
15-
rand = { workspace = true }
1615
serde_json = { workspace = true }
1716
solana-client = { workspace = true }
1817
solana-clock = { workspace = true }
@@ -44,6 +43,7 @@ tungstenite = { workspace = true, features = ["rustls-tls-webpki-roots"] }
4443

4544
[dev-dependencies]
4645
solana-logger = { workspace = true }
46+
solana-net-utils = { workspace = true }
4747
solana-rpc = { workspace = true, features = ["dev-context-only-utils"] }
4848
solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
4949

client-test/tests/client.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use {
22
futures_util::StreamExt,
3-
rand::Rng,
43
serde_json::{json, Value},
54
solana_clock::Slot,
65
solana_commitment_config::{CommitmentConfig, CommitmentLevel},
@@ -52,10 +51,8 @@ use {
5251
};
5352

5453
fn pubsub_addr() -> SocketAddr {
55-
SocketAddr::new(
56-
IpAddr::V4(Ipv4Addr::UNSPECIFIED),
57-
rand::thread_rng().gen_range(1024..65535),
58-
)
54+
let port_range = solana_net_utils::sockets::localhost_port_range_for_tests();
55+
SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), port_range.0)
5956
}
6057

6158
#[test]

0 commit comments

Comments
 (0)