From 387d41e5df34841b7d60e34bd3e7dce4cbbdac96 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 7 Jan 2017 12:48:15 -0800 Subject: [PATCH] test: shutdown extra non "seed" nodes after tests they're created in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit ensures that any extra nodes that were created as part of the integration tests are shutdown at the end of the test after it completes successfully. This should speed up the tests as we’ll no longer have lingering nodes in the background of the test consuming resources. --- lnd_test.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lnd_test.go b/lnd_test.go index 49dbf0b4..745159e2 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -930,6 +930,13 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) { closeChannelAndAssert(t, net, ctxt, net.Alice, chanPointAlice, false) ctxt, _ = context.WithTimeout(ctxb, timeout) closeChannelAndAssert(t, net, ctxt, carol, chanPointCarol, false) + + // Finally, shutdown the node we created for the duration of the tests, + // only leaving the two seed nodes (Alice and Bob) within our test + // network. + if err := carol.shutdown(); err != nil { + t.Fatalf("unable to shutdown carol: %v", err) + } } func testInvoiceSubscriptions(net *networkHarness, t *harnessTest) { @@ -1132,12 +1139,19 @@ func testMaxPendingChannels(net *networkHarness, t *harnessTest) { chanPoints[i] = fundingChanPoint } - // Finally close the channel between Alice and Carol, asserting that - // the channel has been properly closed on-chain. + // Next, close the channel between Alice and Carol, asserting that the + // channel has been properly closed on-chain. for _, chanPoint := range chanPoints { ctxt, _ := context.WithTimeout(context.Background(), timeout) closeChannelAndAssert(t, net, ctxt, net.Alice, chanPoint, false) } + + // Finally, shutdown the node we created for the duration of the tests, + // only leaving the two seed nodes (Alice and Bob) within our test + // network. + if err := carol.shutdown(); err != nil { + t.Fatalf("unable to shutdown carol: %v", err) + } } func copyFile(dest, src string) error {