MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestLoop_SetWatchdogTimeout

Function TestLoop_SetWatchdogTimeout

internal/loop/loop_test.go:449–462  ·  view source on GitHub ↗

TestLoop_SetWatchdogTimeout tests setting the watchdog timeout.

(t *testing.T)

Source from the content-addressed store, hash-verified

447
448// TestLoop_SetWatchdogTimeout tests setting the watchdog timeout.
449func TestLoop_SetWatchdogTimeout(t *testing.T) {
450 l := NewLoop("/test/prd.json", "test", 5, testProvider)
451
452 l.SetWatchdogTimeout(10 * time.Minute)
453 if l.WatchdogTimeout() != 10*time.Minute {
454 t.Errorf("Expected watchdog timeout 10m, got %v", l.WatchdogTimeout())
455 }
456
457 // Setting to 0 disables the watchdog
458 l.SetWatchdogTimeout(0)
459 if l.WatchdogTimeout() != 0 {
460 t.Errorf("Expected watchdog timeout 0 (disabled), got %v", l.WatchdogTimeout())
461 }
462}
463
464// TestLoop_WatchdogKillsHungProcess tests that a hung process is killed after timeout.
465func TestLoop_WatchdogKillsHungProcess(t *testing.T) {

Callers

nothing calls this directly

Calls 3

SetWatchdogTimeoutMethod · 0.95
WatchdogTimeoutMethod · 0.95
NewLoopFunction · 0.85

Tested by

no test coverage detected