Skip to content

Commit

Permalink
increase overly short require.Eventually intervals (#1501)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored May 18, 2022
1 parent 9cb3cd1 commit 9538154
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion itest/rcmgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions p2p/net/connmgr/decay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)

Expand All @@ -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) {
Expand Down Expand Up @@ -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"])

Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion p2p/transport/quic/reuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 9538154

Please sign in to comment.