From 42e93c26b21b690263b0a029445c664f462d7200 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Wed, 15 May 2024 10:15:24 -0700 Subject: [PATCH 1/2] test: give windows file watcher more time --- src/servers/src/tls.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/servers/src/tls.rs b/src/servers/src/tls.rs index 2055081012ca..b9262e4478e8 100644 --- a/src/servers/src/tls.rs +++ b/src/servers/src/tls.rs @@ -425,7 +425,11 @@ mod tests { .expect("failed to copy key to tmpdir"); // waiting for async load + #[cfg(not(target_os = "windows"))] std::thread::sleep(std::time::Duration::from_millis(300)); + #[cfg(target_os = "windows")] + std::thread::sleep(std::time::Duration::from_millis(2000)); + assert!(server_config.get_version() > 1); assert!(server_config.get_server_config().is_some()); } From 11fad61f05abf779992a8996de965f34a7b19860 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Wed, 15 May 2024 10:53:00 -0700 Subject: [PATCH 2/2] refactor: use constants for timeout --- src/servers/src/tls.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/servers/src/tls.rs b/src/servers/src/tls.rs index b9262e4478e8..2b6a9439431a 100644 --- a/src/servers/src/tls.rs +++ b/src/servers/src/tls.rs @@ -426,9 +426,11 @@ mod tests { // waiting for async load #[cfg(not(target_os = "windows"))] - std::thread::sleep(std::time::Duration::from_millis(300)); + let timeout_millis = 300; #[cfg(target_os = "windows")] - std::thread::sleep(std::time::Duration::from_millis(2000)); + let timeout_millis = 2000; + + std::thread::sleep(std::time::Duration::from_millis(timeout_millis)); assert!(server_config.get_version() > 1); assert!(server_config.get_server_config().is_some());