Skip to content

Commit

Permalink
use rstest timeout on cleanup_on_client_closed stealer test
Browse files Browse the repository at this point in the history
  • Loading branch information
Razz4780 committed Jan 23, 2025
1 parent b034331 commit adc763b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mirrord/agent/src/steal/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ where

#[cfg(test)]
mod test {
use std::net::SocketAddr;
use std::{net::SocketAddr, time::Duration};

use bytes::Bytes;
use futures::{future::BoxFuture, FutureExt};
Expand Down Expand Up @@ -983,6 +983,8 @@ mod test {

/// Verifies that [`TcpConnectionStealer`] removes client's port subscriptions
/// when client's [`TcpStealerApi`] is dropped.
#[rstest]
#[timeout(Duration::from_secs(5))]
#[tokio::test]
async fn cleanup_on_client_closed() {
let (command_tx, command_rx) = mpsc::channel(8);
Expand Down Expand Up @@ -1022,11 +1024,7 @@ mod test {

std::mem::drop(api);

let notification =
tokio::time::timeout(std::time::Duration::from_secs(5), redirect_rx.recv())
.await
.unwrap()
.unwrap();
let notification = redirect_rx.recv().await.unwrap();
assert_eq!(notification, RedirectNotification::Removed(80));
}
}

0 comments on commit adc763b

Please sign in to comment.