diff --git a/linkerd/app/outbound/src/tcp/logical.rs b/linkerd/app/outbound/src/tcp/logical.rs index 6a587f63a6..adfb12c620 100644 --- a/linkerd/app/outbound/src/tcp/logical.rs +++ b/linkerd/app/outbound/src/tcp/logical.rs @@ -248,7 +248,7 @@ mod tests { resolve_tx .add(Some((ep0_addr, Default::default()))) .unwrap(); - time::sleep(time::Duration::from_secs(1)).await; // Let the balancer observe the update. + tokio::task::yield_now().await; // Let the balancer observe the update. let (io, task) = spawn_io(); svc.clone().oneshot(io).await.unwrap(); let msg = task.await.unwrap().unwrap(); @@ -259,7 +259,7 @@ mod tests { resolve_tx .add(Some((ep1_addr, Default::default()))) .unwrap(); - time::sleep(time::Duration::from_secs(1)).await; // Let the balancer observe the update. + tokio::task::yield_now().await; // Let the balancer observe the update. let mut seen0 = false; let mut seen1 = false; for i in 1..=100 { @@ -294,7 +294,7 @@ mod tests { // When we remove the ep0, all traffic goes to ep1: resolve_tx.remove(Some(ep0_addr)).unwrap(); - time::sleep(time::Duration::from_secs(1)).await; // Let the balancer observe the update. + tokio::task::yield_now().await; // Let the balancer observe the update. for _ in 1..=100 { let (io, task) = spawn_io(); svc.clone().oneshot(io).await.unwrap(); @@ -306,7 +306,7 @@ mod tests { // Empty load balancers hit fail-fast errors: resolve_tx.remove(Some(ep1_addr)).unwrap(); - time::sleep(time::Duration::from_secs(1)).await; // Let the balancer observe the update. + tokio::task::yield_now().await; // Let the balancer observe the update. let (io, task) = spawn_io(); let err = svc .clone()