From 1cb973f84473f5c1f65132b39a21e991093cc868 Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 14 Jun 2022 10:08:27 +0000 Subject: Adjust error margin for heartbeat test --- pkg/discord/gateway/heartbeat_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/discord/gateway/heartbeat_test.go b/pkg/discord/gateway/heartbeat_test.go index f148d35..18862cf 100644 --- a/pkg/discord/gateway/heartbeat_test.go +++ b/pkg/discord/gateway/heartbeat_test.go @@ -16,7 +16,7 @@ func TestHeartBeats(t *testing.T) { // This is probably a flaky test, if it fails, change the error margin. // Also, Discord sets it's own interval acceptance margins, perhaps we should // use that instead of a hardcoded error margin. - errorMargin := 1 * time.Millisecond + errorMargin := 2 * time.Millisecond logger := zerolog.New(zerolog.NewTestWriter(t)) g := mocks.Gateway{} @@ -39,7 +39,7 @@ func TestHeartBeats(t *testing.T) { <-beats jitter := time.Since(start) - require.Less(t, jitter, interval, "the first jitter heartbeat should happen before the interval") + require.Less(t, jitter, interval+errorMargin, "the first jitter heartbeat should happen before the interval") start = time.Now() <-beats -- cgit 1.4.1