Skip to content

Commit ebf0b4e

Browse files
authored
idle: speed up test by 5x even while running 2x more iterations (#6555)
1 parent 7d3996f commit ebf0b4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

idle_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func (ri *racyIdlenessEnforcer) enterIdleMode() error {
322322
// mode.
323323
func (s) TestIdlenessManager_IdleTimeoutRacesWithOnCallBegin(t *testing.T) {
324324
// Run multiple iterations to simulate different possibilities.
325-
for i := 0; i < 10; i++ {
325+
for i := 0; i < 20; i++ {
326326
t.Run(fmt.Sprintf("iteration=%d", i), func(t *testing.T) {
327327
var idlenessState racyIdlenessState
328328
enforcer := &racyIdlenessEnforcer{state: &idlenessState}
@@ -337,7 +337,7 @@ func (s) TestIdlenessManager_IdleTimeoutRacesWithOnCallBegin(t *testing.T) {
337337
go func() {
338338
defer wg.Done()
339339
m := mgr.(interface{ handleIdleTimeout() })
340-
<-time.After(defaultTestIdleTimeout)
340+
<-time.After(defaultTestIdleTimeout / 10)
341341
m.handleIdleTimeout()
342342
}()
343343
for j := 0; j < 100; j++ {
@@ -346,7 +346,7 @@ func (s) TestIdlenessManager_IdleTimeoutRacesWithOnCallBegin(t *testing.T) {
346346
defer wg.Done()
347347
// Wait for the configured idle timeout and simulate an RPC to
348348
// race with the idle timeout timer callback.
349-
<-time.After(defaultTestIdleTimeout)
349+
<-time.After(defaultTestIdleTimeout / 10)
350350
if err := mgr.onCallBegin(); err != nil {
351351
t.Errorf("onCallBegin() failed: %v", err)
352352
}

0 commit comments

Comments
 (0)