mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 05:32:17 +02:00
itest: use prefixed sub-tests
More sub-tests are needed in "coop close with external delivery" itest, which would break the limit for 50 blocks mined. Turning it into prefixed itest. Also used new exclusion approach in test "remote signer" where all the prefixed tests are excluded.
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
// be excluded from the test suite atm.
|
||||
//
|
||||
// TODO(yy): fix these tests and remove them from this list.
|
||||
var excludedTestsWindows = []string{
|
||||
var excludedTestsWindows = append(append([]string{
|
||||
"batch channel funding",
|
||||
"zero conf channel open",
|
||||
"open channel with unstable utxos",
|
||||
@@ -45,26 +45,12 @@ var excludedTestsWindows = []string{
|
||||
"wipe forwarding packages",
|
||||
|
||||
"coop close with htlcs",
|
||||
"coop close with external delivery",
|
||||
|
||||
"forward interceptor restart",
|
||||
"forward interceptor dedup htlcs",
|
||||
"invoice HTLC modifier basic",
|
||||
"lookup htlc resolution",
|
||||
|
||||
"remote signer-taproot",
|
||||
"remote signer-account import",
|
||||
"remote signer-bump fee",
|
||||
"remote signer-funding input types",
|
||||
"remote signer-funding async payments taproot",
|
||||
"remote signer-funding async payments",
|
||||
"remote signer-random seed",
|
||||
"remote signer-verify msg",
|
||||
"remote signer-channel open",
|
||||
"remote signer-shared key",
|
||||
"remote signer-psbt",
|
||||
"remote signer-sign output raw",
|
||||
|
||||
"on chain to blinded",
|
||||
"query blinded route",
|
||||
|
||||
@@ -76,7 +62,12 @@ var excludedTestsWindows = []string{
|
||||
// more investigation is needed.
|
||||
"channel force close-anchor restart",
|
||||
"channel force close-simple taproot restart",
|
||||
}
|
||||
}, extractNames(
|
||||
"coop close with external delivery",
|
||||
coopCloseWithExternalTestCases)...,
|
||||
),
|
||||
extractNames("remote signer", remoteSignerTestCases)...,
|
||||
)
|
||||
|
||||
// filterWindowsFlakyTests filters out the flaky tests that are excluded from
|
||||
// the test suite on Windows.
|
||||
|
@@ -5,6 +5,7 @@ package itest
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/lntest"
|
||||
)
|
||||
|
||||
@@ -642,10 +643,6 @@ var allTestCases = []*lntest.TestCase{
|
||||
Name: "sweep commit output and anchor",
|
||||
TestFunc: testSweepCommitOutputAndAnchor,
|
||||
},
|
||||
{
|
||||
Name: "coop close with external delivery",
|
||||
TestFunc: testCoopCloseWithExternalDelivery,
|
||||
},
|
||||
{
|
||||
Name: "payment failed htlc local swept",
|
||||
TestFunc: testPaymentFailedHTLCLocalSwept,
|
||||
@@ -720,6 +717,13 @@ func appendPrefixed(prefix string, testCases,
|
||||
return testCases
|
||||
}
|
||||
|
||||
// extractNames is used to extract tests' names from a group of prefixed tests.
|
||||
func extractNames(prefix string, subtestCases []*lntest.TestCase) []string {
|
||||
return fn.Map(subtestCases, func(tc *lntest.TestCase) string {
|
||||
return fmt.Sprintf("%s-%s", prefix, tc.Name)
|
||||
})
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Register subtests.
|
||||
allTestCases = appendPrefixed(
|
||||
@@ -762,6 +766,10 @@ func init() {
|
||||
allTestCases = appendPrefixed(
|
||||
"wallet", allTestCases, walletTestCases,
|
||||
)
|
||||
allTestCases = appendPrefixed(
|
||||
"coop close with external delivery", allTestCases,
|
||||
coopCloseWithExternalTestCases,
|
||||
)
|
||||
|
||||
// Prepare the test cases for windows to exclude some of the flaky
|
||||
// ones.
|
||||
|
@@ -2,7 +2,6 @@ package itest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
@@ -11,53 +10,50 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func testCoopCloseWithExternalDelivery(ht *lntest.HarnessTest) {
|
||||
ok := ht.Run("set P2WPKH delivery address at open", func(t *testing.T) {
|
||||
tt := ht.Subtest(t)
|
||||
testCoopCloseWithExternalDeliveryImpl(
|
||||
tt, true, lnrpc.AddressType_UNUSED_WITNESS_PUBKEY_HASH,
|
||||
)
|
||||
})
|
||||
// Abort the test if failed.
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
ok = ht.Run("set P2WPKH delivery address at close", func(t *testing.T) {
|
||||
tt := ht.Subtest(t)
|
||||
testCoopCloseWithExternalDeliveryImpl(
|
||||
tt, false, lnrpc.AddressType_UNUSED_WITNESS_PUBKEY_HASH,
|
||||
)
|
||||
})
|
||||
// Abort the test if failed.
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
ok = ht.Run("set P2TR delivery address at open", func(t *testing.T) {
|
||||
tt := ht.Subtest(t)
|
||||
testCoopCloseWithExternalDeliveryImpl(
|
||||
tt, true, lnrpc.AddressType_UNUSED_TAPROOT_PUBKEY,
|
||||
)
|
||||
})
|
||||
// Abort the test if failed.
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
ht.Run("set P2TR delivery address at close", func(t *testing.T) {
|
||||
tt := ht.Subtest(t)
|
||||
testCoopCloseWithExternalDeliveryImpl(
|
||||
tt, false, lnrpc.AddressType_UNUSED_TAPROOT_PUBKEY,
|
||||
)
|
||||
})
|
||||
var coopCloseWithExternalTestCases = []*lntest.TestCase{
|
||||
{
|
||||
Name: "set P2WPKH delivery address at open",
|
||||
TestFunc: func(ht *lntest.HarnessTest) {
|
||||
testCoopCloseWithExternalDelivery(
|
||||
ht, true,
|
||||
lnrpc.AddressType_UNUSED_WITNESS_PUBKEY_HASH,
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "set P2WPKH delivery address at close",
|
||||
TestFunc: func(ht *lntest.HarnessTest) {
|
||||
testCoopCloseWithExternalDelivery(
|
||||
ht, false,
|
||||
lnrpc.AddressType_UNUSED_WITNESS_PUBKEY_HASH,
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "set P2TR delivery address at open",
|
||||
TestFunc: func(ht *lntest.HarnessTest) {
|
||||
testCoopCloseWithExternalDelivery(
|
||||
ht, true,
|
||||
lnrpc.AddressType_UNUSED_TAPROOT_PUBKEY,
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "set P2TR delivery address at close",
|
||||
TestFunc: func(ht *lntest.HarnessTest) {
|
||||
testCoopCloseWithExternalDelivery(
|
||||
ht, false,
|
||||
lnrpc.AddressType_UNUSED_TAPROOT_PUBKEY,
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// testCoopCloseWithExternalDeliveryImpl ensures that we have a valid settled
|
||||
// testCoopCloseWithExternalDelivery ensures that we have a valid settled
|
||||
// balance irrespective of whether the delivery address is in LND's wallet or
|
||||
// not. Some users set this value to be an address in a different wallet and
|
||||
// this should not affect our ability to accurately report the settled balance.
|
||||
func testCoopCloseWithExternalDeliveryImpl(ht *lntest.HarnessTest,
|
||||
func testCoopCloseWithExternalDelivery(ht *lntest.HarnessTest,
|
||||
upfrontShutdown bool, deliveryAddressType lnrpc.AddressType) {
|
||||
|
||||
alice := ht.NewNodeWithCoins("Alice", nil)
|
||||
|
Reference in New Issue
Block a user