Browse Source

Bump timeout in CI for flaky test (#1800)

pull/1817/head
Marco Munizaga 2 years ago
committed by GitHub
parent
commit
f940b1d627
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      p2p/net/connmgr/decay_test.go

17
p2p/net/connmgr/decay_test.go

@ -1,6 +1,7 @@
package connmgr package connmgr
import ( import (
"os"
"testing" "testing"
"time" "time"
@ -142,13 +143,25 @@ func TestMultiplePeers(t *testing.T) {
_ = tag3.Bump(ids[2], 100) _ = tag3.Bump(ids[2], 100)
// allow the background goroutine to process bumps. // allow the background goroutine to process bumps.
waitFor := 100 * time.Millisecond
tick := 10 * time.Millisecond
if os.Getenv("CI") != "" {
waitFor *= 10
tick *= 10
}
require.Eventually(t, func() bool { require.Eventually(t, func() bool {
return mgr.GetTagInfo(ids[0]) != nil && mgr.GetTagInfo(ids[1]) != nil && mgr.GetTagInfo(ids[2]) != nil return mgr.GetTagInfo(ids[0]) != nil && mgr.GetTagInfo(ids[1]) != nil && mgr.GetTagInfo(ids[2]) != nil
}, 100*time.Millisecond, 10*time.Millisecond) }, waitFor, tick)
mockClock.Add(3 * time.Second) mockClock.Add(3 * time.Second)
require.Eventually(t, func() bool { return mgr.GetTagInfo(ids[0]).Value == 2670 }, 500*time.Millisecond, 10*time.Millisecond) waitFor = 500 * time.Millisecond
if os.Getenv("CI") != "" {
waitFor *= 10
}
require.Eventually(t, func() bool { return mgr.GetTagInfo(ids[0]).Value == 2670 }, waitFor, tick)
require.Equal(t, 1170, mgr.GetTagInfo(ids[1]).Value) require.Equal(t, 1170, mgr.GetTagInfo(ids[1]).Value)
require.Equal(t, 40, mgr.GetTagInfo(ids[2]).Value) require.Equal(t, 40, mgr.GetTagInfo(ids[2]).Value)
} }

Loading…
Cancel
Save