mempool: fix TestReactorNoBroadcastToSender (#5984)

## Description

Looks like I missed a test in the original PR when fixing the tests.

Closes: #5956
This commit is contained in:
Aleksandr Bezobchuk
2021-01-26 17:33:26 +00:00
committed by GitHub
parent 937a18468a
commit b19acfb605
2 changed files with 11 additions and 5 deletions
+5
View File
@@ -224,11 +224,16 @@ func (r *Reactor) processMempoolCh() {
case envelope := <-r.mempoolCh.In():
if err := r.handleMessage(r.mempoolCh.ID(), envelope); err != nil {
r.Logger.Error("failed to process message", "ch_id", r.mempoolCh.ID(), "envelope", envelope, "err", err)
fmt.Println("MESSAGE HANDLER ERROR:", err)
r.mempoolCh.Error() <- p2p.PeerError{
PeerID: envelope.From,
Err: err,
Severity: p2p.PeerErrorSeverityLow,
}
fmt.Println("SENT PEER ERROR ON CHANNEL")
}
case <-r.closeCh:
+6 -5
View File
@@ -7,7 +7,6 @@ import (
"testing"
"time"
"github.com/fortytw2/leaktest"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/abci/example/kvstore"
@@ -287,6 +286,12 @@ func TestReactorNoBroadcastToSender(t *testing.T) {
primary := testSuites[0]
secondary := testSuites[1]
go func() {
// drop all errors on the mempool channel
for range primary.mempoolPeerErrCh {
}
}()
peerID := uint16(1)
_ = checkTxs(t, primary.reactor.mempool, numTxs, peerID)
@@ -454,8 +459,4 @@ func TestBroadcastTxForPeerStopsWhenPeerStops(t *testing.T) {
Status: p2p.PeerStatusDown,
PeerID: secondary.peerID,
}
// check that we are not leaking any go-routines
// i.e. broadcastTxRoutine finishes when peer is stopped
leaktest.CheckTimeout(t, 10*time.Second)()
}