swarm/network: fix data races in TestInitialPeersMsg test (#19490)

* swarm/network: fix data races in TestInitialPeersMsg test

* swarm/network: add Kademlia.Saturation method with lock

* swarm/network: add Hive.Peer method to safely retrieve a bzz peer

* swarm/network: remove duplicate comment

* p2p/testing: prevent goroutine leak in ProtocolTester

* swarm/network: fix data race in newBzzBaseTesterWithAddrs

* swarm/network: fix goroutone leaks in testInitialPeersMsg

* swarm/network: raise number of peer check attempts in testInitialPeersMsg

* swarm/network: use Hive.Peer in Hive.PeerInfo function

* swarm/network: reduce the scope of mutex lock in newBzzBaseTesterWithAddrs

* swarm/storage: disable TestCleanIndex with race detector
This commit is contained in:
Janoš Guljaš
2019-04-25 21:33:18 +02:00
committed by Viktor Trón
parent 92a849a509
commit 3873a7314d
6 changed files with 37 additions and 10 deletions

View File

@@ -27,12 +27,11 @@ import (
"strings"
"testing"
"github.com/ethereum/go-ethereum/swarm/testutil"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/swarm/chunk"
"github.com/ethereum/go-ethereum/swarm/log"
"github.com/ethereum/go-ethereum/swarm/storage/mock/mem"
"github.com/ethereum/go-ethereum/swarm/testutil"
ldberrors "github.com/syndtr/goleveldb/leveldb/errors"
)
@@ -606,6 +605,10 @@ func TestLDBStoreCollectGarbageAccessUnlikeIndex(t *testing.T) {
}
func TestCleanIndex(t *testing.T) {
if testutil.RaceEnabled {
t.Skip("disabled because it times out with race detector")
}
capacity := 5000
n := 3