mirror of https://github.com/grpc/grpc-go.git
idle: speed up test by 5x even while running 2x more iterations (#6555)
This commit is contained in:
parent
7d3996fd85
commit
ebf0b4e367
|
|
@ -322,7 +322,7 @@ func (ri *racyIdlenessEnforcer) enterIdleMode() error {
|
|||
// mode.
|
||||
func (s) TestIdlenessManager_IdleTimeoutRacesWithOnCallBegin(t *testing.T) {
|
||||
// Run multiple iterations to simulate different possibilities.
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := 0; i < 20; i++ {
|
||||
t.Run(fmt.Sprintf("iteration=%d", i), func(t *testing.T) {
|
||||
var idlenessState racyIdlenessState
|
||||
enforcer := &racyIdlenessEnforcer{state: &idlenessState}
|
||||
|
|
@ -337,7 +337,7 @@ func (s) TestIdlenessManager_IdleTimeoutRacesWithOnCallBegin(t *testing.T) {
|
|||
go func() {
|
||||
defer wg.Done()
|
||||
m := mgr.(interface{ handleIdleTimeout() })
|
||||
<-time.After(defaultTestIdleTimeout)
|
||||
<-time.After(defaultTestIdleTimeout / 10)
|
||||
m.handleIdleTimeout()
|
||||
}()
|
||||
for j := 0; j < 100; j++ {
|
||||
|
|
@ -346,7 +346,7 @@ func (s) TestIdlenessManager_IdleTimeoutRacesWithOnCallBegin(t *testing.T) {
|
|||
defer wg.Done()
|
||||
// Wait for the configured idle timeout and simulate an RPC to
|
||||
// race with the idle timeout timer callback.
|
||||
<-time.After(defaultTestIdleTimeout)
|
||||
<-time.After(defaultTestIdleTimeout / 10)
|
||||
if err := mgr.onCallBegin(); err != nil {
|
||||
t.Errorf("onCallBegin() failed: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue