TestLoop_WatchdogReturnsError tests that watchdog kill causes runIteration to return an error that feeds into retry logic.
(t *testing.T)
| 645 | // TestLoop_WatchdogReturnsError tests that watchdog kill causes runIteration to return an error |
| 646 | // that feeds into retry logic. |
| 647 | func 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. |
| 662 | func TestLoop_WatchdogWithWorkDir(t *testing.T) { |
nothing calls this directly
no test coverage detected