Skip to content
Merged
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
9 changes: 5 additions & 4 deletions core/crates/drivers/cassandra/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ mod tests {
use tablepro_core::{LivenessPolicy, NetworkEndpoint};
use tablepro_net::DirectTcpTransport;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
use tokio::net::{TcpListener, TcpSocket};

use super::*;

Expand Down Expand Up @@ -140,9 +140,10 @@ mod tests {

#[tokio::test]
async fn a_failed_open_is_kept_for_the_connect_to_report() {
let unused = TcpListener::bind((Ipv4Addr::LOCALHOST, 0)).await.unwrap();
let endpoint = NetworkEndpoint::new("127.0.0.1", unused.local_addr().unwrap().port()).unwrap();
drop(unused);
// Bound and never listening: on Windows a dropped listener's port went to another test's relay.
let refusing = TcpSocket::new_v4().unwrap();
refusing.bind((Ipv4Addr::LOCALHOST, 0).into()).unwrap();
let endpoint = NetworkEndpoint::new("127.0.0.1", refusing.local_addr().unwrap().port()).unwrap();
let relay = Relay::start(Arc::new(DirectTcpTransport::new(endpoint, &LivenessPolicy::DESKTOP))).unwrap();

let mut client = TcpStream::connect(relay.address()).await.unwrap();
Expand Down
Loading