From 6ba8a5b65c0bb991c2b2d6509ffe66b06e75702a Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Sun, 24 Feb 2019 21:04:14 -0500 Subject: [PATCH] swarm/network/simulation: defer sim.Clsoe() --- swarm/network/simulation/kademlia_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/swarm/network/simulation/kademlia_test.go b/swarm/network/simulation/kademlia_test.go index 557c8c0f0b..b3fcb7698f 100644 --- a/swarm/network/simulation/kademlia_test.go +++ b/swarm/network/simulation/kademlia_test.go @@ -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) } }