mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-10 09:52:20 +08:00
wait for peers in wantmanager to all appear
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
@ -158,6 +158,19 @@ func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {
|
||||
|
||||
t.Log("Give the blocks to the first instance")
|
||||
|
||||
nump := len(instances) - 1
|
||||
// assert we're properly connected
|
||||
for _, inst := range instances {
|
||||
peers := inst.Exchange.wm.ConnectedPeers()
|
||||
for i := 0; i < 10 && len(peers) != nump; i++ {
|
||||
time.Sleep(time.Millisecond * 50)
|
||||
peers = inst.Exchange.wm.ConnectedPeers()
|
||||
}
|
||||
if len(peers) != nump {
|
||||
t.Fatal("not enough peers connected to instance")
|
||||
}
|
||||
}
|
||||
|
||||
var blkeys []key.Key
|
||||
first := instances[0]
|
||||
for _, b := range blocks {
|
||||
|
Reference in New Issue
Block a user