Skip to content

Commit a803877

Browse files
committed
make DEFAULT_EVENT_WAIT_TIMEOUT configurable
1 parent dcd83c8 commit a803877

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
timeout-minutes: 60
6161
env:
6262
RUST_BACKTRACE: 1
63+
CI_EVENT_TIMEOUT: 180
6364
steps:
6465
- uses: actions/checkout@v6
6566
- uses: rui314/setup-mold@v1

crates/node/src/test_utils/event_utils.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ use rollup_node_chain_orchestrator::ChainOrchestratorEvent;
99
use rollup_node_primitives::ChainImport;
1010
use tokio::time::timeout;
1111

12-
/// The default event wait time.
13-
pub const DEFAULT_EVENT_WAIT_TIMEOUT: Duration = Duration::from_secs(180);
12+
/// Get the default event wait timeout.
13+
/// Checks the `CI_EVENT_TIMEOUT` environment variable at runtime.
14+
/// Defaults to 30 seconds if not set.
15+
pub fn default_event_wait_timeout() -> Duration {
16+
std::env::var("CI_EVENT_TIMEOUT")
17+
.ok()
18+
.and_then(|s| s.parse::<u64>().ok())
19+
.map(Duration::from_secs)
20+
.unwrap_or(Duration::from_secs(30))
21+
}
1422

1523
/// Builder for waiting for events on multiple nodes.
1624
#[derive(Debug)]
@@ -22,8 +30,8 @@ pub struct EventWaiter<'a> {
2230

2331
impl<'a> EventWaiter<'a> {
2432
/// Create a new multi-node event waiter.
25-
pub const fn new(fixture: &'a mut TestFixture, node_indices: Vec<usize>) -> Self {
26-
Self { fixture, node_indices, timeout_duration: Duration::from_secs(30) }
33+
pub fn new(fixture: &'a mut TestFixture, node_indices: Vec<usize>) -> Self {
34+
Self { fixture, node_indices, timeout_duration: default_event_wait_timeout() }
2735
}
2836

2937
/// Set a custom timeout for waiting.

0 commit comments

Comments
 (0)