TestLoop_WatchdogDisabledWithZeroTimeout tests that watchdog is disabled when timeout is 0.
(t *testing.T)
| 581 | |
| 582 | // TestLoop_WatchdogDisabledWithZeroTimeout tests that watchdog is disabled when timeout is 0. |
| 583 | func 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. |
| 607 | func TestLoop_LastOutputTimeUpdated(t *testing.T) { |
nothing calls this directly
no test coverage detected