mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
swarm/network/stream: enforce waitKademlia, improve TestIntervals
This commit is contained in:
parent
e8522eab62
commit
0e3a050c87
3 changed files with 13 additions and 20 deletions
|
|
@ -424,11 +424,9 @@ func testDeliveryFromNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck
|
|||
}
|
||||
}()
|
||||
|
||||
if *waitKademlia {
|
||||
log.Debug("Waiting for kademlia")
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
return err
|
||||
}
|
||||
log.Debug("Waiting for kademlia")
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debug("Watching for disconnections")
|
||||
|
|
@ -560,10 +558,8 @@ func benchmarkDeliveryFromNodes(b *testing.B, nodes, conns, chunkCount int, skip
|
|||
}
|
||||
netStore := item.(*storage.NetStore)
|
||||
|
||||
if *waitKademlia {
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
disconnections := sim.PeerEvents(
|
||||
|
|
|
|||
|
|
@ -96,12 +96,13 @@ func testIntervals(t *testing.T, live bool, history *Range, skipCheck bool) {
|
|||
defer sim.Close()
|
||||
|
||||
log.Info("Adding nodes to simulation")
|
||||
_, err := sim.AddNodesAndConnectFull(nodes)
|
||||
_, err := sim.AddNodesAndConnectChain(nodes)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
|
||||
defer cancel()
|
||||
|
||||
result := sim.Run(ctx, func(ctx context.Context, sim *simulation.Simulation) error {
|
||||
nodeIDs := sim.UpNodeIDs()
|
||||
|
|
@ -139,11 +140,9 @@ func testIntervals(t *testing.T, live bool, history *Range, skipCheck bool) {
|
|||
liveErrC := make(chan error)
|
||||
historyErrC := make(chan error)
|
||||
|
||||
if *waitKademlia {
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
log.Error("WaitKademlia error: %v", "err", err)
|
||||
return err
|
||||
}
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
log.Error("WaitKademlia error: %v", "err", err)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Debug("Watching for disconnections")
|
||||
|
|
|
|||
|
|
@ -181,10 +181,8 @@ func testSyncBetweenNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck
|
|||
}
|
||||
}
|
||||
// here we distribute chunks of a random file into stores 1...nodes
|
||||
if *waitKademlia {
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := sim.WaitTillHealthy(ctx, 2); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// collect hashes in po 1 bin for each node
|
||||
|
|
|
|||
Loading…
Reference in a new issue