From 970cbbad6de94eade64a855b7c29f3deaacbb2eb Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 25 May 2020 17:33:13 +0200 Subject: [PATCH] blockchain[v1]: increased timeout times for peer tests (#4871) --- blockchain/v1/peer_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blockchain/v1/peer_test.go b/blockchain/v1/peer_test.go index 0e7a73473..fd9e9f14b 100644 --- a/blockchain/v1/peer_test.go +++ b/blockchain/v1/peer_test.go @@ -32,7 +32,7 @@ func TestPeerResetBlockResponseTimer(t *testing.T) { lastErr error // last generated error peerTestMtx sync.Mutex // modifications of ^^ variables are also done from timer handler goroutine ) - params := &BpPeerParams{timeout: 2 * time.Millisecond} + params := &BpPeerParams{timeout: 20 * time.Millisecond} peer := NewBpPeer( p2p.ID(tmrand.Str(12)), 0, 10, @@ -55,12 +55,12 @@ func TestPeerResetBlockResponseTimer(t *testing.T) { // reset with running timer peer.resetBlockResponseTimer() - time.Sleep(time.Millisecond) + time.Sleep(5 * time.Millisecond) peer.resetBlockResponseTimer() assert.NotNil(t, peer.blockResponseTimer) // let the timer expire and ... - time.Sleep(3 * time.Millisecond) + time.Sleep(50 * time.Millisecond) // ... check timer is not running checkByStoppingPeerTimer(t, peer, false) @@ -181,7 +181,7 @@ func TestPeerAddBlock(t *testing.T) { func TestPeerOnErrFuncCalledDueToExpiration(t *testing.T) { - params := &BpPeerParams{timeout: 2 * time.Millisecond} + params := &BpPeerParams{timeout: 10 * time.Millisecond} var ( numErrFuncCalls int // number of calls to the onErr function lastErr error // last generated error @@ -201,7 +201,7 @@ func TestPeerOnErrFuncCalledDueToExpiration(t *testing.T) { peer.SetLogger(log.TestingLogger()) peer.RequestSent(1) - time.Sleep(4 * time.Millisecond) + time.Sleep(50 * time.Millisecond) // timer should have expired by now, check that the on error function was called peerTestMtx.Lock() assert.Equal(t, 1, numErrFuncCalls)