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

Function TestLoop_WatchdogDisabledWithZeroTimeout

internal/loop/loop_test.go:583–604  ·  view source on GitHub ↗

TestLoop_WatchdogDisabledWithZeroTimeout tests that watchdog is disabled when timeout is 0.

(t *testing.T)

Source from the content-addressed store, hash-verified

581
582// TestLoop_WatchdogDisabledWithZeroTimeout tests that watchdog is disabled when timeout is 0.
583func TestLoop_WatchdogDisabledWithZeroTimeout(t *testing.T) {
584 l := NewLoop("/test/prd.json", "test", 5, testProvider)
585 l.SetWatchdogTimeout(0)
586
587 if l.WatchdogTimeout() != 0 {
588 t.Errorf("Expected watchdog timeout 0, got %v", l.WatchdogTimeout())
589 }
590
591 // Verify that runIteration would not start a watchdog
592 // (tested indirectly: timeout == 0 means the if-block in runIteration is skipped)
593 // We test this by verifying the constructor behavior and setter
594 l2 := NewLoop("/test/prd.json", "test", 5, testProvider)
595 l2.SetWatchdogTimeout(0)
596
597 l2.mu.Lock()
598 wt := l2.watchdogTimeout
599 l2.mu.Unlock()
600
601 if wt != 0 {
602 t.Errorf("Expected internal watchdogTimeout to be 0, got %v", wt)
603 }
604}
605
606// TestLoop_LastOutputTimeUpdated tests that lastOutputTime is updated on each scanner output.
607func TestLoop_LastOutputTimeUpdated(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