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

Function TestLoop_WatchdogReturnsError

internal/loop/loop_test.go:647–659  ·  view source on GitHub ↗

TestLoop_WatchdogReturnsError tests that watchdog kill causes runIteration to return an error that feeds into retry logic.

(t *testing.T)

Source from the content-addressed store, hash-verified

645// TestLoop_WatchdogReturnsError tests that watchdog kill causes runIteration to return an error
646// that feeds into retry logic.
647func TestLoop_WatchdogReturnsError(t *testing.T) {
648 // This test verifies the error message format that runIterationWithRetry will see
649 l := NewLoop("/test/prd.json", "test", 5, testProvider)
650 l.SetWatchdogTimeout(100 * time.Millisecond)
651
652 // The watchdog error message should contain "watchdog timeout"
653 // This ensures the retry logic in runIterationWithRetry will process it
654 expectedPrefix := "watchdog timeout:"
655 errMsg := fmt.Sprintf("watchdog timeout: no output for %s", 100*time.Millisecond)
656 if !strings.HasPrefix(errMsg, expectedPrefix) {
657 t.Errorf("Expected error to start with %q, got %q", expectedPrefix, errMsg)
658 }
659}
660
661// TestLoop_WatchdogWithWorkDir tests that watchdog works with NewLoopWithWorkDir too.
662func TestLoop_WatchdogWithWorkDir(t *testing.T) {

Callers

nothing calls this directly

Calls 2

SetWatchdogTimeoutMethod · 0.95
NewLoopFunction · 0.85

Tested by

no test coverage detected