From e68a3bf40b618f2beede2be62d2b1bcccaa94f9b Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Sat, 18 Nov 2023 16:36:06 -0500 Subject: [PATCH] Make the test timeout configurable from an environment variable These can be slower when running the amd64 Docker images on an arm64 host. --- compiler/base/orchestrator/src/coordinator.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/base/orchestrator/src/coordinator.rs b/compiler/base/orchestrator/src/coordinator.rs index 87a1363d9..d715edf73 100644 --- a/compiler/base/orchestrator/src/coordinator.rs +++ b/compiler/base/orchestrator/src/coordinator.rs @@ -2846,6 +2846,11 @@ mod tests { Ok(()) } + static TIMEOUT: Lazy = Lazy::new(|| { + let millis = env::var("TESTS_TIMEOUT_MS").ok().and_then(|v| v.parse().ok()).unwrap_or(5000); + Duration::from_millis(millis) + }); + trait TimeoutExt: Future + Sized { #[allow(clippy::type_complexity)] fn with_timeout( @@ -2854,7 +2859,7 @@ mod tests { tokio::time::Timeout, fn(Result) -> Self::Output, > { - tokio::time::timeout(Duration::from_millis(5000), self) + tokio::time::timeout(*TIMEOUT, self) .map(|v| v.expect("The operation timed out")) } }