Skip to content

Commit 700df49

Browse files
committed
Make the test timeout configurable from an environment variable
These can be slower when running the amd64 Docker images on an arm64 host.
1 parent c66de3f commit 700df49

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ jobs:
224224
- name: Run orchestrator unit tests
225225
env:
226226
TESTS_MAX_CONCURRENCY: 3
227+
TESTS_TIMEOUT_MS: 30000
227228
run: chmod +x ./server/unit_tests_orchestrator && ./server/unit_tests_orchestrator
228229
- name: Run ui unit tests
229230
run: chmod +x ./server/unit_tests_ui && ./server/unit_tests_ui

ci/workflows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ workflows:
314314
- name: "Run orchestrator unit tests"
315315
env:
316316
TESTS_MAX_CONCURRENCY: 3
317+
TESTS_TIMEOUT_MS: 30000
317318
run: |-
318319
chmod +x ./server/unit_tests_orchestrator && ./server/unit_tests_orchestrator
319320

compiler/base/orchestrator/src/coordinator.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,6 +2846,14 @@ mod tests {
28462846
Ok(())
28472847
}
28482848

2849+
static TIMEOUT: Lazy<Duration> = Lazy::new(|| {
2850+
let millis = env::var("TESTS_TIMEOUT_MS")
2851+
.ok()
2852+
.and_then(|v| v.parse().ok())
2853+
.unwrap_or(5000);
2854+
Duration::from_millis(millis)
2855+
});
2856+
28492857
trait TimeoutExt: Future + Sized {
28502858
#[allow(clippy::type_complexity)]
28512859
fn with_timeout(
@@ -2854,8 +2862,7 @@ mod tests {
28542862
tokio::time::Timeout<Self>,
28552863
fn(Result<Self::Output, tokio::time::error::Elapsed>) -> Self::Output,
28562864
> {
2857-
tokio::time::timeout(Duration::from_millis(5000), self)
2858-
.map(|v| v.expect("The operation timed out"))
2865+
tokio::time::timeout(*TIMEOUT, self).map(|v| v.expect("The operation timed out"))
28592866
}
28602867
}
28612868

0 commit comments

Comments
 (0)