(t *testing.T)
| 574 | } |
| 575 | |
| 576 | func TestShouldDebounceRemove(t *testing.T) { |
| 577 | w := &Watcher{} |
| 578 | path := filepath.Clean("test.json") |
| 579 | |
| 580 | if w.shouldDebounceRemove(path, time.Now()) { |
| 581 | t.Fatal("first call should not debounce") |
| 582 | } |
| 583 | if !w.shouldDebounceRemove(path, time.Now()) { |
| 584 | t.Fatal("second call within window should debounce") |
| 585 | } |
| 586 | |
| 587 | w.clientsMutex.Lock() |
| 588 | w.lastRemoveTimes = map[string]time.Time{path: time.Now().Add(-2 * authRemoveDebounceWindow)} |
| 589 | w.clientsMutex.Unlock() |
| 590 | |
| 591 | if w.shouldDebounceRemove(path, time.Now()) { |
| 592 | t.Fatal("call after window should not debounce") |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | func TestAuthFileUnchangedUsesHash(t *testing.T) { |
| 597 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected