Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion gossip/tests/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ fn retransmit_to(
#[test]
fn gossip_ring() {
solana_logger::setup();
run_gossip_topo(50, |listen| {
run_gossip_topo(40, |listen| {
let num = listen.len();
for n in 0..num {
let y = n % listen.len();
Expand Down
15 changes: 8 additions & 7 deletions net-utils/src/sockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ use {
sync::atomic::{AtomicU16, Ordering},
},
};

// base port for deconflicted allocations
const BASE_PORT: u16 = 5000;

// how much to allocate per individual process.
// we expect to have at most 64 concurrent tests in CI at any moment on a given host.
const SLICE_PER_PROCESS: u16 = (u16::MAX - BASE_PORT) / 64;
/// Retrieve a free 20-port slice for unit tests
///
/// When running under nextest, this will try to provide
Expand All @@ -25,15 +27,14 @@ pub fn localhost_port_range_for_tests() -> (u16, u16) {
Ok(slot) => {
let slot: u16 = slot.parse().unwrap();
assert!(
offset < 1000,
"Overrunning into the port range of another test!"
offset < SLICE_PER_PROCESS,
"Overrunning into the port range of another test! Consider using fewer ports per test."
);

BASE_PORT + slot * 1000
BASE_PORT + slot * SLICE_PER_PROCESS
}
Err(_) => BASE_PORT,
};
assert!(start < 65500, "ran out of port numbers!");
assert!(start < u16::MAX - 20, "ran out of port numbers!");
(start, start + 20)
}

Expand Down
3 changes: 3 additions & 0 deletions nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ dir = "target/nextest"
failure-output = "immediate-final"
slow-timeout = { period = "60s", terminate-after = 1 }
retries = { backoff = "fixed", count = 3, delay = "1s" }
# Prevent nextest from using > 64 processes at once
# setting this higher may break port allocation logic in net-utils
max-threads = 64

[profile.ci.junit]
path = "junit.xml"
Expand Down
Loading