autopilot: replace defer cleanup with t.Cleanup

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun committed 2022-10-13 17:01:31 +08:00
1 parent 4b827179bb
commit 1dcc7d74e6
4 files changed
+50 -97

No files matched your search

+6 -9
View File
@@ -85,22 +85,19 @@ func TestTopCentrality(t *testing.T) {
for _, chanGraph := range chanGraphs {
chanGraph := chanGraph
success := t.Run(chanGraph.name, func(t *testing.T) {
t.Parallel()
success := t.Run(chanGraph.name, func(t1 *testing.T) {
t1.Parallel()
graph, cleanup, err := chanGraph.genFunc()
require.NoError(t, err, "unable to create graph")
if cleanup != nil {
defer cleanup()
}
graph, err := chanGraph.genFunc(t1)
require.NoError(t1, err, "unable to create graph")
// Build the test graph.
graphNodes := buildTestGraph(
t, graph, centralityTestGraph,
t1, graph, centralityTestGraph,
)
for _, chans := range channelsWith {
testTopCentrality(t, graph, graphNodes, chans)
testTopCentrality(t1, graph, graphNodes, chans)
}
})