lnwallet: break early in TestLightningWallet when a sub-test fails

This commit is contained in:
Olaoluwa Osuntokun 2019-10-31 21:48:06 -07:00
parent c3a7da5ce7
commit 6b729ec9f5
No known key found for this signature in database
GPG Key ID: BC13F65E2DC84465

@ -2871,8 +2871,10 @@ func TestLightningWallet(t *testing.T) {
for _, walletDriver := range lnwallet.RegisteredWallets() { for _, walletDriver := range lnwallet.RegisteredWallets() {
for _, backEnd := range walletDriver.BackEnds() { for _, backEnd := range walletDriver.BackEnds() {
runTests(t, walletDriver, backEnd, miningNode, if !runTests(t, walletDriver, backEnd, miningNode,
rpcConfig, chainNotifier) rpcConfig, chainNotifier) {
return
}
} }
} }
} }
@ -2884,7 +2886,7 @@ func TestLightningWallet(t *testing.T) {
func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver, func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
backEnd string, miningNode *rpctest.Harness, backEnd string, miningNode *rpctest.Harness,
rpcConfig rpcclient.ConnConfig, rpcConfig rpcclient.ConnConfig,
chainNotifier *btcdnotify.BtcdNotifier) { chainNotifier chainntnfs.ChainNotifier) bool {
var ( var (
bio lnwallet.BlockChainIO bio lnwallet.BlockChainIO
@ -3113,8 +3115,7 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
bob, err := createTestWallet( bob, err := createTestWallet(
tempTestDirBob, miningNode, netParams, tempTestDirBob, miningNode, netParams,
chainNotifier, bobWalletController, bobKeyRing, chainNotifier, bobWalletController, bobKeyRing, bobSigner, bio,
bobSigner, bio,
) )
if err != nil { if err != nil {
t.Fatalf("unable to create test ln wallet: %v", err) t.Fatalf("unable to create test ln wallet: %v", err)
@ -3135,7 +3136,7 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
walletTest.test(miningNode, alice, bob, t) walletTest.test(miningNode, alice, bob, t)
}) })
if !success { if !success {
break return false
} }
// TODO(roasbeef): possible reset mining // TODO(roasbeef): possible reset mining
@ -3146,4 +3147,6 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
t.Fatalf("unable to wipe wallet state: %v", err) t.Fatalf("unable to wipe wallet state: %v", err)
} }
} }
return true
} }