From 95381549e197bb7a32ece2fbe9158591e35bd083 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 18 May 2022 21:14:57 +0200 Subject: [PATCH] increase overly short require.Eventually intervals (#1501) --- itest/rcmgr_test.go | 2 +- p2p/net/connmgr/decay_test.go | 12 ++++++------ p2p/transport/quic/reuse_test.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/itest/rcmgr_test.go b/itest/rcmgr_test.go index fc6584dd8..e2a40d5f1 100644 --- a/itest/rcmgr_test.go +++ b/itest/rcmgr_test.go @@ -44,7 +44,7 @@ func waitForConnection(t *testing.T, src, dest *Echo) { require.Eventually(t, func() bool { return src.Host.Network().Connectedness(dest.Host.ID()) == network.Connected && dest.Host.Network().Connectedness(src.Host.ID()) == network.Connected - }, time.Second, time.Millisecond) + }, time.Second, 10*time.Millisecond) } func TestResourceManagerConnInbound(t *testing.T) { diff --git a/p2p/net/connmgr/decay_test.go b/p2p/net/connmgr/decay_test.go index dc2953d54..bf9992aba 100644 --- a/p2p/net/connmgr/decay_test.go +++ b/p2p/net/connmgr/decay_test.go @@ -16,7 +16,7 @@ const TestResolution = 50 * time.Millisecond func waitForTag(t *testing.T, mgr *BasicConnMgr, id peer.ID) { t.Helper() - require.Eventually(t, func() bool { return mgr.GetTagInfo(id) != nil }, 500*time.Millisecond, time.Millisecond) + require.Eventually(t, func() bool { return mgr.GetTagInfo(id) != nil }, 500*time.Millisecond, 10*time.Millisecond) } func TestDecayExpire(t *testing.T) { @@ -51,7 +51,7 @@ func TestMultipleBumps(t *testing.T) { require.Equal(t, mgr.GetTagInfo(id).Value, 10) require.NoError(t, tag.Bump(id, 100)) - require.Eventually(t, func() bool { return mgr.GetTagInfo(id).Value == 20 }, 100*time.Millisecond, time.Millisecond, "expected tag value to decay to 20") + require.Eventually(t, func() bool { return mgr.GetTagInfo(id).Value == 20 }, 100*time.Millisecond, 10*time.Millisecond, "expected tag value to decay to 20") } func TestMultipleTagsNoDecay(t *testing.T) { @@ -144,7 +144,7 @@ func TestMultiplePeers(t *testing.T) { // allow the background goroutine to process bumps. require.Eventually(t, func() bool { return mgr.GetTagInfo(ids[0]) != nil && mgr.GetTagInfo(ids[1]) != nil && mgr.GetTagInfo(ids[2]) != nil - }, 100*time.Millisecond, time.Millisecond) + }, 100*time.Millisecond, 10*time.Millisecond) mockClock.Add(3 * time.Second) @@ -170,7 +170,7 @@ func TestLinearDecayOverwrite(t *testing.T) { require.Equal(t, 250, mgr.GetTagInfo(id).Value) _ = tag1.Bump(id, 1000) - require.Eventually(t, func() bool { return mgr.GetTagInfo(id).Value == 1000 }, 500*time.Millisecond, time.Millisecond, "expected value to be 1000") + require.Eventually(t, func() bool { return mgr.GetTagInfo(id).Value == 1000 }, 500*time.Millisecond, 10*time.Millisecond, "expected value to be 1000") } func TestResolutionMisaligned(t *testing.T) { @@ -241,7 +241,7 @@ func TestTagRemoval(t *testing.T) { // next tick. both peers only have 1 tag, both at 998 value. mockClock.Add(TestResolution) - require.Eventually(t, func() bool { return mgr.GetTagInfo(id1).Tags["beep"] == 0 }, 500*time.Millisecond, time.Millisecond) + require.Eventually(t, func() bool { return mgr.GetTagInfo(id1).Tags["beep"] == 0 }, 500*time.Millisecond, 10*time.Millisecond) require.Equal(t, 998, mgr.GetTagInfo(id1).Tags["bop"]) require.Equal(t, 998, mgr.GetTagInfo(id2).Tags["beep"]) @@ -281,7 +281,7 @@ func TestTagClosure(t *testing.T) { require.NoError(t, tag1.Close()) // allow the background goroutine to process the closure. - require.Eventually(t, func() bool { return mgr.GetTagInfo(id).Value == 998 }, 500*time.Millisecond, time.Millisecond) + require.Eventually(t, func() bool { return mgr.GetTagInfo(id).Value == 998 }, 500*time.Millisecond, 10*time.Millisecond) // a second closure should not error. require.NoError(t, tag1.Close()) diff --git a/p2p/transport/quic/reuse_test.go b/p2p/transport/quic/reuse_test.go index 9267b1b5a..736a4fe81 100644 --- a/p2p/transport/quic/reuse_test.go +++ b/p2p/transport/quic/reuse_test.go @@ -171,5 +171,5 @@ func TestReuseGarbageCollect(t *testing.T) { require.Equal(t, num, 1) time.Sleep(2 * time.Millisecond) } - require.Eventually(t, func() bool { return numGlobals() == 0 }, 4*garbageCollectInterval, 5*time.Millisecond) + require.Eventually(t, func() bool { return numGlobals() == 0 }, 4*garbageCollectInterval, 10*time.Millisecond) }