TestManager_Enabled_TimerFires tests the case where the idle manager is enabled. Ensures that when there are no RPCs, the timer callback is invoked and the EnterIdleMode() method is invoked on the enforcer.
(t *testing.T)
| 129 | // is enabled. Ensures that when there are no RPCs, the timer callback is |
| 130 | // invoked and the EnterIdleMode() method is invoked on the enforcer. |
| 131 | func (s) TestManager_Enabled_TimerFires(t *testing.T) { |
| 132 | callbackCh := overrideNewTimer(t) |
| 133 | |
| 134 | enforcer := newTestEnforcer() |
| 135 | mgr := NewManager(enforcer, time.Duration(defaultTestIdleTimeout)) |
| 136 | defer mgr.Close() |
| 137 | mgr.ExitIdleMode() |
| 138 | |
| 139 | // Ensure that the timer callback fires within an appropriate amount of time. |
| 140 | select { |
| 141 | case <-callbackCh: |
| 142 | case <-time.After(2 * defaultTestIdleTimeout): |
| 143 | t.Fatal("Timeout waiting for idle timer callback to fire") |
| 144 | } |
| 145 | |
| 146 | // Ensure that the channel moves to idle mode eventually. |
| 147 | select { |
| 148 | case <-enforcer.enterIdleCh: |
| 149 | case <-time.After(defaultTestTimeout): |
| 150 | t.Fatal("Timeout waiting for channel to move to idle") |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | // TestManager_Enabled_OngoingCall tests the case where the idle manager |
| 155 | // is enabled. Ensures that when there is an ongoing RPC, the channel does not |
nothing calls this directly
no test coverage detected