Reduce stall watchdog test sleep times for faster test runs

Shrink timeouts and handler durations by ~5-10x. The tests verify
the same relative timing behavior (keepalive interval < stall timeout,
hung handler outlasts timeout) with smaller absolute values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-03 21:41:09 -05:00
parent 9243c94ded
commit 3e28e6acda
2 changed files with 16 additions and 16 deletions

View file

@ -4080,7 +4080,7 @@ mod tests {
.insert("goal".to_string(), AttrValue::String("test".to_string()));
g.attrs.insert(
"stall_timeout".to_string(),
AttrValue::Duration(Duration::from_millis(200)),
AttrValue::Duration(Duration::from_millis(50)),
);
g.attrs
.insert("default_max_retry".to_string(), AttrValue::Integer(0));
@ -4140,7 +4140,7 @@ mod tests {
.insert("goal".to_string(), AttrValue::String("test".to_string()));
g.attrs.insert(
"stall_timeout".to_string(),
AttrValue::Duration(Duration::from_millis(200)),
AttrValue::Duration(Duration::from_millis(100)),
);
g.attrs
.insert("default_max_retry".to_string(), AttrValue::Integer(0));
@ -4173,8 +4173,8 @@ mod tests {
registry.register(
"emitting",
Box::new(EmittingHandler {
interval_ms: 100,
total_ms: 500,
interval_ms: 10,
total_ms: 50,
}),
);
let engine = WorkflowRunEngine::new(registry, Arc::new(EventEmitter::new()), local_env());
@ -4231,7 +4231,7 @@ mod tests {
g.edges.push(Edge::new("work", "exit"));
let mut registry = make_registry();
registry.register("slow", Box::new(SlowHandler { sleep_ms: 200 }));
registry.register("slow", Box::new(SlowHandler { sleep_ms: 50 }));
let engine = WorkflowRunEngine::new(registry, Arc::new(EventEmitter::new()), local_env());
let config = RunConfig {
logs_root: dir.path().to_path_buf(),

View file

@ -10943,7 +10943,7 @@ impl Handler for KeepaliveHandler {
async fn e2e_stall_watchdog_triggers_from_dot_parsed_pipeline() {
// Parse a DOT graph with stall_timeout set to 200ms
let dot = r#"digraph StallTest {
graph [goal="Test stall watchdog", stall_timeout="200ms", default_max_retry=0]
graph [goal="Test stall watchdog", stall_timeout="50ms", default_max_retry=0]
start [shape=Mdiamond]
work [type="hanging", label="Work"]
exit [shape=Msquare]
@ -10954,7 +10954,7 @@ async fn e2e_stall_watchdog_triggers_from_dot_parsed_pipeline() {
// Verify the stall_timeout was parsed correctly
assert_eq!(
graph.stall_timeout(),
Some(std::time::Duration::from_millis(200)),
Some(std::time::Duration::from_millis(50)),
);
let dir = tempfile::tempdir().unwrap();
@ -11007,7 +11007,7 @@ async fn e2e_stall_watchdog_kept_alive_by_handler_events() {
// Parse a DOT graph with stall_timeout 200ms, but the handler emits events
// every 100ms for 500ms total — the watchdog should NOT trigger.
let dot = r#"digraph StallAliveTest {
graph [goal="Test stall keepalive", stall_timeout="200ms", default_max_retry=0]
graph [goal="Test stall keepalive", stall_timeout="100ms", default_max_retry=0]
start [shape=Mdiamond]
work [type="keepalive", label="Work"]
exit [shape=Msquare]
@ -11022,8 +11022,8 @@ async fn e2e_stall_watchdog_kept_alive_by_handler_events() {
registry.register(
"keepalive",
Box::new(KeepaliveHandler {
interval_ms: 100,
total_ms: 500,
interval_ms: 10,
total_ms: 50,
}),
);
@ -11062,7 +11062,7 @@ async fn e2e_stall_watchdog_disabled_with_zero_timeout() {
let mut registry = HandlerRegistry::new(Box::new(StartHandler));
registry.register("start", Box::new(StartHandler));
registry.register("exit", Box::new(ExitHandler));
registry.register("slow", Box::new(SlowTestHandler { sleep_ms: 200 }));
registry.register("slow", Box::new(SlowTestHandler { sleep_ms: 50 }));
let engine = WorkflowRunEngine::new(registry, Arc::new(EventEmitter::new()), local_env());
let config = RunConfig {
@ -11103,10 +11103,10 @@ impl Handler for SlowTestHandler {
#[tokio::test]
async fn e2e_stall_watchdog_with_explicit_timeout_override() {
// A short stall_timeout of 100ms should trigger faster than the default 600s.
// A short stall_timeout of 50ms should trigger faster than the default 600s.
// This tests that the graph attribute is actually respected.
let dot = r#"digraph StallOverrideTest {
graph [goal="Test stall override", stall_timeout="100ms", default_max_retry=0]
graph [goal="Test stall override", stall_timeout="50ms", default_max_retry=0]
start [shape=Mdiamond]
work [type="hanging", label="Work"]
exit [shape=Msquare]
@ -11115,7 +11115,7 @@ async fn e2e_stall_watchdog_with_explicit_timeout_override() {
let graph = parse(dot).expect("parse should succeed");
assert_eq!(
graph.stall_timeout(),
Some(std::time::Duration::from_millis(100)),
Some(std::time::Duration::from_millis(50)),
);
let dir = tempfile::tempdir().unwrap();
@ -11144,9 +11144,9 @@ async fn e2e_stall_watchdog_with_explicit_timeout_override() {
assert!(result.is_err(), "expected stall watchdog error");
let err = result.unwrap_err().to_string();
assert!(err.contains("stall watchdog"), "got: {err}");
// Should trigger well under 2 seconds (100ms timeout + check interval overhead)
// Should trigger well under 1 second (50ms timeout + check interval overhead)
assert!(
elapsed < std::time::Duration::from_secs(2),
elapsed < std::time::Duration::from_secs(1),
"stall watchdog took too long: {elapsed:?}"
);
}