test: shutdown extra non "seed" nodes after tests they're created in

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-01-07 12:48:15 -08:00
parent 573eb1dfc4
commit 387d41e5df
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -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 {