mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network/simulation: defer sim.Clsoe()
This commit is contained in:
parent
aa001605b9
commit
6ba8a5b65c
1 changed files with 6 additions and 1 deletions
|
|
@ -50,6 +50,7 @@ func TestWaitTillHealthy(t *testing.T) {
|
|||
|
||||
// create the first simulation
|
||||
sim := New(simServiceMap)
|
||||
defer sim.Close()
|
||||
|
||||
// connect and...
|
||||
_, err := sim.AddNodesAndConnectRing(testNodesNum)
|
||||
|
|
@ -77,7 +78,6 @@ func TestWaitTillHealthy(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sim.Close()
|
||||
|
||||
// create a control simulation
|
||||
controlSim := New(createSimServiceMap(false))
|
||||
|
|
@ -88,6 +88,10 @@ func TestWaitTillHealthy(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = controlSim.WaitTillHealthy(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// for each node...
|
||||
nodeIDs := controlSim.UpNodeIDs()
|
||||
if len(nodeIDs) != testNodesNum {
|
||||
|
|
@ -122,6 +126,7 @@ func TestWaitTillHealthy(t *testing.T) {
|
|||
healthy := info.Healthy()
|
||||
log.Trace("Node is healthy", "node", node, "healthy", healthy)
|
||||
if !healthy {
|
||||
log.Trace("Unhealthy kademlia", "kad", kad.String())
|
||||
t.Fatalf("Expected node %v of control simulation to be healthy, but it is not", node)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue