mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-30 03:35:34 +00:00
blockchain[v1]: increased timeout times for peer tests (#4871)
This commit is contained in:
@@ -32,7 +32,7 @@ func TestPeerResetBlockResponseTimer(t *testing.T) {
|
|||||||
lastErr error // last generated error
|
lastErr error // last generated error
|
||||||
peerTestMtx sync.Mutex // modifications of ^^ variables are also done from timer handler goroutine
|
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(
|
peer := NewBpPeer(
|
||||||
p2p.ID(tmrand.Str(12)), 0, 10,
|
p2p.ID(tmrand.Str(12)), 0, 10,
|
||||||
@@ -55,12 +55,12 @@ func TestPeerResetBlockResponseTimer(t *testing.T) {
|
|||||||
|
|
||||||
// reset with running timer
|
// reset with running timer
|
||||||
peer.resetBlockResponseTimer()
|
peer.resetBlockResponseTimer()
|
||||||
time.Sleep(time.Millisecond)
|
time.Sleep(5 * time.Millisecond)
|
||||||
peer.resetBlockResponseTimer()
|
peer.resetBlockResponseTimer()
|
||||||
assert.NotNil(t, peer.blockResponseTimer)
|
assert.NotNil(t, peer.blockResponseTimer)
|
||||||
|
|
||||||
// let the timer expire and ...
|
// let the timer expire and ...
|
||||||
time.Sleep(3 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
// ... check timer is not running
|
// ... check timer is not running
|
||||||
checkByStoppingPeerTimer(t, peer, false)
|
checkByStoppingPeerTimer(t, peer, false)
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ func TestPeerAddBlock(t *testing.T) {
|
|||||||
|
|
||||||
func TestPeerOnErrFuncCalledDueToExpiration(t *testing.T) {
|
func TestPeerOnErrFuncCalledDueToExpiration(t *testing.T) {
|
||||||
|
|
||||||
params := &BpPeerParams{timeout: 2 * time.Millisecond}
|
params := &BpPeerParams{timeout: 10 * time.Millisecond}
|
||||||
var (
|
var (
|
||||||
numErrFuncCalls int // number of calls to the onErr function
|
numErrFuncCalls int // number of calls to the onErr function
|
||||||
lastErr error // last generated error
|
lastErr error // last generated error
|
||||||
@@ -201,7 +201,7 @@ func TestPeerOnErrFuncCalledDueToExpiration(t *testing.T) {
|
|||||||
peer.SetLogger(log.TestingLogger())
|
peer.SetLogger(log.TestingLogger())
|
||||||
|
|
||||||
peer.RequestSent(1)
|
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
|
// timer should have expired by now, check that the on error function was called
|
||||||
peerTestMtx.Lock()
|
peerTestMtx.Lock()
|
||||||
assert.Equal(t, 1, numErrFuncCalls)
|
assert.Equal(t, 1, numErrFuncCalls)
|
||||||
|
|||||||
Reference in New Issue
Block a user