From 5c51323aa2fa397623ed03084cad20f62e25d635 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 6 Mar 2019 12:01:08 -0800 Subject: [PATCH] mock: increase tolerance for latency tests These were exceeding their tolerances when run under the race detector on CI. --- p2p/net/mock/mock_test.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/p2p/net/mock/mock_test.go b/p2p/net/mock/mock_test.go index de7cc582..fa53c16e 100644 --- a/p2p/net/mock/mock_test.go +++ b/p2p/net/mock/mock_test.go @@ -489,36 +489,36 @@ func TestAdding(t *testing.T) { func TestRateLimiting(t *testing.T) { rl := NewRateLimiter(10) - if !within(rl.Limit(10), time.Duration(float32(time.Second)), time.Millisecond/10) { - t.Fail() + if !within(rl.Limit(10), time.Duration(float32(time.Second)), time.Millisecond) { + t.Fatal() } if !within(rl.Limit(10), time.Duration(float32(time.Second*2)), time.Millisecond) { - t.Fail() + t.Fatal() } if !within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) { - t.Fail() + t.Fatal() } if within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) { - t.Fail() + t.Fatal() } rl.UpdateBandwidth(50) - if !within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond/10) { - t.Fail() + if !within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond) { + t.Fatal() } - if within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond/10) { - t.Fail() + if within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond) { + t.Fatal() } rl.UpdateBandwidth(100) - if !within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond/10) { - t.Fail() + if !within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond) { + t.Fatal() } - if within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond/10) { - t.Fail() + if within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond) { + t.Fatal() } }