overrideNewTimer overrides the new timer creation function by ensuring that a message is pushed on the returned channel everytime the timer fires.
(t *testing.T)
| 66 | // overrideNewTimer overrides the new timer creation function by ensuring that a |
| 67 | // message is pushed on the returned channel everytime the timer fires. |
| 68 | func overrideNewTimer(t *testing.T) <-chan struct{} { |
| 69 | t.Helper() |
| 70 | |
| 71 | ch := make(chan struct{}, 1) |
| 72 | origTimeAfterFunc := timeAfterFunc |
| 73 | timeAfterFunc = func(d time.Duration, callback func()) *time.Timer { |
| 74 | return time.AfterFunc(d, func() { |
| 75 | select { |
| 76 | case ch <- struct{}{}: |
| 77 | default: |
| 78 | } |
| 79 | callback() |
| 80 | }) |
| 81 | } |
| 82 | t.Cleanup(func() { timeAfterFunc = origTimeAfterFunc }) |
| 83 | return ch |
| 84 | } |
| 85 | |
| 86 | // TestManager_Disabled tests the case where the idleness manager is |
| 87 | // disabled by passing an idle_timeout of 0. Verifies the following things: |
no outgoing calls
no test coverage detected