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