huskies: merge 1175 bug Flaky tests intermittently fail merge gates

This commit is contained in:
Huskies Agent
2026-07-16 13:03:05 +00:00
parent 6a1ee8377d
commit 6f8a8ffd87
4 changed files with 48 additions and 4 deletions
+9 -1
View File
@@ -89,7 +89,15 @@ mod tests {
#[test]
fn find_free_port_returns_bindable_port() {
let port = find_free_port(3100);
// Scan from an OS-assigned ephemeral port rather than a hardcoded low
// port. Fixed ports like 3100 are also used as scan starts elsewhere
// in production code and tests, so a second, independent bind on a
// fixed port can race against those under parallel test execution.
let reservation = std::net::TcpListener::bind(("127.0.0.1", 0)).unwrap();
let start = reservation.local_addr().unwrap().port();
drop(reservation);
let port = find_free_port(start);
// The returned port must be bindable.
assert!(
std::net::TcpListener::bind(("127.0.0.1", port)).is_ok(),