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

This commit is contained in:
Olaoluwa Osuntokun committed 2019-12-02 17:11:58 -06:00
1 parent c3a7da5ce7
commit 6b729ec9f5
1 file changed
+9 -6
+9 -6
View File
@@ -2871,8 +2871,10 @@ func TestLightningWallet(t *testing.T) {
for _, walletDriver := range lnwallet.RegisteredWallets() {
for _, backEnd := range walletDriver.BackEnds() {
runTests(t, walletDriver, backEnd, miningNode,
rpcConfig, chainNotifier)
if !runTests(t, walletDriver, backEnd, miningNode,
rpcConfig, chainNotifier) {
return
}
}
}
}
@@ -2884,7 +2886,7 @@ func TestLightningWallet(t *testing.T) {
func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
backEnd string, miningNode *rpctest.Harness,
rpcConfig rpcclient.ConnConfig,
chainNotifier *btcdnotify.BtcdNotifier) {
chainNotifier chainntnfs.ChainNotifier) bool {
var (
bio lnwallet.BlockChainIO
@@ -3113,8 +3115,7 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
bob, err := createTestWallet(
tempTestDirBob, miningNode, netParams,
chainNotifier, bobWalletController, bobKeyRing,
bobSigner, bio,
chainNotifier, bobWalletController, bobKeyRing, bobSigner, bio,
)
if err != nil {
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)
})
if !success {
break
return false
}
// 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)
}
}
return true
}