From f940b1d627368de956ae9c76fa0487df7aa81b0a Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 6 Oct 2022 12:53:17 -0700 Subject: [PATCH] Bump timeout in CI for flaky test (#1800) --- p2p/net/connmgr/decay_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/p2p/net/connmgr/decay_test.go b/p2p/net/connmgr/decay_test.go index bd28b3269..d75aee0f2 100644 --- a/p2p/net/connmgr/decay_test.go +++ b/p2p/net/connmgr/decay_test.go @@ -1,6 +1,7 @@ package connmgr import ( + "os" "testing" "time" @@ -142,13 +143,25 @@ func TestMultiplePeers(t *testing.T) { _ = tag3.Bump(ids[2], 100) // 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 { 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) - 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, 40, mgr.GetTagInfo(ids[2]).Value) }