From 9c98af4277d4507b19eb582cba877776bdaa7b66 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Sun, 24 Jan 2021 13:45:55 +0100 Subject: [PATCH] test: fix TestPEXReactorRunning data race (#5955) Fixes #5941. Not entirely sure that this will fix the problem (couldn't reproduce), but in any case this is an artifact of a hack in the P2P transport refactor to make it work with the legacy P2P stack, and will be removed when the refactor is done anyway. --- p2p/pex/pex_reactor_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/p2p/pex/pex_reactor_test.go b/p2p/pex/pex_reactor_test.go index a32164628..768725b91 100644 --- a/p2p/pex/pex_reactor_test.go +++ b/p2p/pex/pex_reactor_test.go @@ -94,6 +94,11 @@ func TestPEXReactorRunning(t *testing.T) { }) } + for _, sw := range switches { + err := sw.Start() // start switch and reactors + require.Nil(t, err) + } + addOtherNodeAddrToAddrBook := func(switchIndex, otherSwitchIndex int) { addr := switches[otherSwitchIndex].NetAddress() err := books[switchIndex].AddAddress(addr, addr) @@ -104,11 +109,6 @@ func TestPEXReactorRunning(t *testing.T) { addOtherNodeAddrToAddrBook(1, 0) addOtherNodeAddrToAddrBook(2, 1) - for _, sw := range switches { - err := sw.Start() // start switch and reactors - require.Nil(t, err) - } - assertPeersWithTimeout(t, switches, 10*time.Millisecond, 10*time.Second, N-1) // stop them