Watch
0
0
Fork
You've already forked hyperhive
0

swarm-queue-client: the readyz test holds its stand-in server's port instead of freeing and rebinding it

This commit is contained in:
damocles 2026-11-22 19:55:55 +01:00 • committed by mara
commit 57e06c9ec8

View file

@ -1964,11 +1964,11 @@ mod tests {
reply.split_whitespace().nth(1).unwrap().parse().unwrap()
}
// A port nothing listens on yet.
let queue_addr = {
let held = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
held.local_addr().unwrap()
};
// A server that has the port but does not answer yet: the listener is
// held from the start (never freed and rebound, which another test
// could take the port in between) and only accepts further down.
let server = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
let queue_addr = server.local_addr().unwrap();
let client = async_nats::ConnectOptions::new()
.retry_on_initial_connect()
.connect(queue_addr.to_string())
@ -1988,7 +1988,6 @@ mod tests {
"alive regardless"
);
let server = tokio::net::TcpListener::bind(queue_addr).await.unwrap();
tokio::spawn(async move {
loop {
let (mut conn, _) = server.accept().await.unwrap();