swarm-queue-client: the readyz test holds its stand-in server's port instead of freeing and rebinding it
This commit is contained in:
parent
e0a5f737ac
commit
57e06c9ec8
1 changed files with 5 additions and 6 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue