From 3f280d44b4bae2935f5120275e1d8b9956ec5bc9 Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Wed, 6 Apr 2022 13:22:19 +0000 Subject: [PATCH] test remote::server::tests::test_reconnect: Give 10 secs more to try Signed-off-by: Gao Xiang --- storage/src/remote/server.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/storage/src/remote/server.rs b/storage/src/remote/server.rs index f75e70a1b8f..977c5170238 100644 --- a/storage/src/remote/server.rs +++ b/storage/src/remote/server.rs @@ -346,7 +346,7 @@ impl AsRawFd for Server { #[cfg(test)] mod tests { use super::*; - use std::time::Duration; + use std::time::{Duration, Instant}; use vmm_sys_util::tempdir::TempDir; #[test] @@ -398,6 +398,14 @@ mod tests { server.stop(); std::thread::sleep(Duration::from_secs(4)); + let starttime = Instant::now(); + /* give 10secs more to try */ + while starttime.elapsed() < Duration::from_secs(10) { + if server.state.active_workers.load(Ordering::Relaxed) == 0 { + break; + } + std::thread::sleep(Duration::from_secs(1)); + } assert_eq!(server.state.active_workers.load(Ordering::Relaxed), 0); drop(server);