itest: add a prefix before appending a subtest case

This commit is contained in:
yyforyongyu
2024-12-04 06:29:22 +08:00
parent 686a7dd31c
commit c536bc220f
11 changed files with 165 additions and 129 deletions

View File

@@ -18,7 +18,9 @@ var excludedTestsWindows = []string{
"zero conf channel open",
"open channel with unstable utxos",
"funding flow persistence",
"channel policy update public zero conf",
// Gives "channel link not found" error.
"zero conf-channel policy update public zero conf",
"listsweeps",
"sweep htlcs",
@@ -30,12 +32,12 @@ var excludedTestsWindows = []string{
"async payments benchmark",
"async bidirectional payments",
"multihop htlc aggregation leased",
"multihop htlc aggregation leased zero conf",
"multihop htlc aggregation anchor",
"multihop htlc aggregation anchor zero conf",
"multihop htlc aggregation simple taproot",
"multihop htlc aggregation simple taproot zero conf",
"multihop-htlc aggregation leased",
"multihop-htlc aggregation leased zero conf",
"multihop-htlc aggregation anchor",
"multihop-htlc aggregation anchor zero conf",
"multihop-htlc aggregation simple taproot",
"multihop-htlc aggregation simple taproot zero conf",
"channel force closure anchor",
"channel force closure simple taproot",
@@ -50,18 +52,18 @@ var excludedTestsWindows = []string{
"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",
"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",
@@ -101,7 +103,8 @@ func filterWindowsFlakyTests() []*lntest.TestCase {
errStr := "\nThe following tests are not found, please make sure the " +
"test names are correct in `excludedTestsWindows`.\n"
for _, name := range excludedSet.ToSlice() {
errStr += fmt.Sprintf("Test not found in test suite: %v", name)
errStr += fmt.Sprintf("Test not found in test suite: %v\n",
name)
}
panic(errStr)

View File

@@ -3,6 +3,8 @@
package itest
import (
"fmt"
"github.com/lightningnetwork/lnd/lntest"
)
@@ -682,19 +684,58 @@ var allTestCases = []*lntest.TestCase{
},
}
// appendPrefixed is used to add a prefix to each test name in the subtests
// before appending them to the main test cases.
func appendPrefixed(prefix string, testCases,
subtestCases []*lntest.TestCase) []*lntest.TestCase {
for _, tc := range subtestCases {
name := fmt.Sprintf("%s-%s", prefix, tc.Name)
testCases = append(testCases, &lntest.TestCase{
Name: name,
TestFunc: tc.TestFunc,
})
}
return testCases
}
func init() {
// Register subtests.
allTestCases = append(allTestCases, multiHopForceCloseTestCases...)
allTestCases = append(allTestCases, watchtowerTestCases...)
allTestCases = append(allTestCases, psbtFundingTestCases...)
allTestCases = append(allTestCases, remoteSignerTestCases...)
allTestCases = append(allTestCases, channelRestoreTestCases...)
allTestCases = append(allTestCases, fundUtxoSelectionTestCases...)
allTestCases = append(allTestCases, zeroConfPolicyTestCases...)
allTestCases = append(allTestCases, channelFeePolicyTestCases...)
allTestCases = append(allTestCases, walletImportAccountTestCases...)
allTestCases = append(allTestCases, basicFundingTestCases...)
allTestCases = append(allTestCases, sendToRouteTestCases...)
allTestCases = appendPrefixed(
"multihop", allTestCases, multiHopForceCloseTestCases,
)
allTestCases = appendPrefixed(
"watchtower", allTestCases, watchtowerTestCases,
)
allTestCases = appendPrefixed(
"psbt", allTestCases, psbtFundingTestCases,
)
allTestCases = appendPrefixed(
"remote signer", allTestCases, remoteSignerTestCases,
)
allTestCases = appendPrefixed(
"channel backup", allTestCases, channelRestoreTestCases,
)
allTestCases = appendPrefixed(
"utxo selection", allTestCases, fundUtxoSelectionTestCases,
)
allTestCases = appendPrefixed(
"zero conf", allTestCases, zeroConfPolicyTestCases,
)
allTestCases = appendPrefixed(
"channel fee policy", allTestCases, channelFeePolicyTestCases,
)
allTestCases = appendPrefixed(
"wallet import account", allTestCases,
walletImportAccountTestCases,
)
allTestCases = appendPrefixed(
"funding", allTestCases, basicFundingTestCases,
)
allTestCases = appendPrefixed(
"send to route", allTestCases, sendToRouteTestCases,
)
// Prepare the test cases for windows to exclude some of the flaky
// ones.

View File

@@ -29,7 +29,7 @@ var channelRestoreTestCases = []*lntest.TestCase{
{
// Restore the backup from the on-disk file, using the RPC
// interface, for anchor commitment channels.
Name: "channel backup restore anchor",
Name: "restore anchor",
TestFunc: func(ht *lntest.HarnessTest) {
runChanRestoreScenarioCommitTypes(
ht, lnrpc.CommitmentType_ANCHORS, false,
@@ -39,7 +39,7 @@ var channelRestoreTestCases = []*lntest.TestCase{
{
// Restore the backup from the on-disk file, using the RPC
// interface, for script-enforced leased channels.
Name: "channel backup restore leased",
Name: "restore leased",
TestFunc: func(ht *lntest.HarnessTest) {
runChanRestoreScenarioCommitTypes(
ht, leasedType, false,
@@ -49,7 +49,7 @@ var channelRestoreTestCases = []*lntest.TestCase{
{
// Restore the backup from the on-disk file, using the RPC
// interface, for zero-conf anchor channels.
Name: "channel backup restore anchor zero conf",
Name: "restore anchor zero conf",
TestFunc: func(ht *lntest.HarnessTest) {
runChanRestoreScenarioCommitTypes(
ht, lnrpc.CommitmentType_ANCHORS, true,
@@ -59,7 +59,7 @@ var channelRestoreTestCases = []*lntest.TestCase{
{
// Restore the backup from the on-disk file, using the RPC
// interface for a zero-conf script-enforced leased channel.
Name: "channel backup restore leased zero conf",
Name: "restore leased zero conf",
TestFunc: func(ht *lntest.HarnessTest) {
runChanRestoreScenarioCommitTypes(
ht, leasedType, true,
@@ -69,7 +69,7 @@ var channelRestoreTestCases = []*lntest.TestCase{
{
// Restore a channel back up of a taproot channel that was
// confirmed.
Name: "channel backup restore simple taproot",
Name: "restore simple taproot",
TestFunc: func(ht *lntest.HarnessTest) {
runChanRestoreScenarioCommitTypes(
ht, lnrpc.CommitmentType_SIMPLE_TAPROOT, false,
@@ -78,7 +78,7 @@ var channelRestoreTestCases = []*lntest.TestCase{
},
{
// Restore a channel back up of an unconfirmed taproot channel.
Name: "channel backup restore simple taproot zero conf",
Name: "restore simple taproot zero conf",
TestFunc: func(ht *lntest.HarnessTest) {
runChanRestoreScenarioCommitTypes(
ht, lnrpc.CommitmentType_SIMPLE_TAPROOT, true,
@@ -86,23 +86,23 @@ var channelRestoreTestCases = []*lntest.TestCase{
},
},
{
Name: "channel backup restore from rpc",
Name: "restore from rpc",
TestFunc: testChannelBackupRestoreFromRPC,
},
{
Name: "channel backup restore from file",
Name: "restore from file",
TestFunc: testChannelBackupRestoreFromFile,
},
{
Name: "channel backup restore during creation",
Name: "restore during creation",
TestFunc: testChannelBackupRestoreDuringCreation,
},
{
Name: "channel backup restore during unlock",
Name: "restore during unlock",
TestFunc: testChannelBackupRestoreDuringUnlock,
},
{
Name: "channel backup restore twice",
Name: "restore twice",
TestFunc: testChannelBackupRestoreTwice,
},
}

View File

@@ -17,31 +17,31 @@ import (
var fundUtxoSelectionTestCases = []*lntest.TestCase{
{
Name: "utxo selection funding error",
Name: "funding error",
TestFunc: testChannelUtxoSelectionError,
},
{
Name: "utxo selection selected valid chan size",
Name: "selected valid chan size",
TestFunc: testUtxoSelectionSelectedValidChanSize,
},
{
Name: "utxo selection selected valid chan reserve",
Name: "selected valid chan reserve",
TestFunc: testUtxoSelectionSelectedValidChanReserve,
},
{
Name: "utxo selection selected reserve from selected",
Name: "selected reserve from selected",
TestFunc: testUtxoSelectionReserveFromSelected,
},
{
Name: "utxo selection fundmax",
Name: "fundmax",
TestFunc: testUtxoSelectionFundmax,
},
{
Name: "utxo selection fundmax reserve",
Name: "fundmax reserve",
TestFunc: testUtxoSelectionFundmaxReserve,
},
{
Name: "utxo selection reused utxo",
Name: "reused utxo",
TestFunc: testUtxoSelectionReuseUTXO,
},
}

View File

@@ -23,15 +23,15 @@ import (
// basicFundingTestCases defines the test cases for the basic funding test.
var basicFundingTestCases = []*lntest.TestCase{
{
Name: "basic funding flow static key remote",
Name: "basic flow static key remote",
TestFunc: testBasicChannelFundingStaticRemote,
},
{
Name: "basic funding flow anchor",
Name: "basic flow anchor",
TestFunc: testBasicChannelFundingAnchor,
},
{
Name: "basic funding flow simple taproot",
Name: "basic flow simple taproot",
TestFunc: testBasicChannelFundingSimpleTaproot,
},
}

View File

@@ -29,171 +29,171 @@ var leasedType = lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE
//nolint:ll
var multiHopForceCloseTestCases = []*lntest.TestCase{
{
Name: "multihop local claim outgoing htlc anchor",
Name: "local claim outgoing htlc anchor",
TestFunc: testLocalClaimOutgoingHTLCAnchor,
},
{
Name: "multihop local claim outgoing htlc anchor zero conf",
Name: "local claim outgoing htlc anchor zero conf",
TestFunc: testLocalClaimOutgoingHTLCAnchorZeroConf,
},
{
Name: "multihop local claim outgoing htlc simple taproot",
Name: "local claim outgoing htlc simple taproot",
TestFunc: testLocalClaimOutgoingHTLCSimpleTaproot,
},
{
Name: "multihop local claim outgoing htlc simple taproot zero conf",
Name: "local claim outgoing htlc simple taproot zero conf",
TestFunc: testLocalClaimOutgoingHTLCSimpleTaprootZeroConf,
},
{
Name: "multihop local claim outgoing htlc leased",
Name: "local claim outgoing htlc leased",
TestFunc: testLocalClaimOutgoingHTLCLeased,
},
{
Name: "multihop local claim outgoing htlc leased zero conf",
Name: "local claim outgoing htlc leased zero conf",
TestFunc: testLocalClaimOutgoingHTLCLeasedZeroConf,
},
{
Name: "multihop receiver preimage claim anchor",
Name: "receiver preimage claim anchor",
TestFunc: testMultiHopReceiverPreimageClaimAnchor,
},
{
Name: "multihop receiver preimage claim anchor zero conf",
Name: "receiver preimage claim anchor zero conf",
TestFunc: testMultiHopReceiverPreimageClaimAnchorZeroConf,
},
{
Name: "multihop receiver preimage claim simple taproot",
Name: "receiver preimage claim simple taproot",
TestFunc: testMultiHopReceiverPreimageClaimSimpleTaproot,
},
{
Name: "multihop receiver preimage claim simple taproot zero conf",
Name: "receiver preimage claim simple taproot zero conf",
TestFunc: testMultiHopReceiverPreimageClaimSimpleTaprootZeroConf,
},
{
Name: "multihop receiver preimage claim leased",
Name: "receiver preimage claim leased",
TestFunc: testMultiHopReceiverPreimageClaimLeased,
},
{
Name: "multihop receiver preimage claim leased zero conf",
Name: "receiver preimage claim leased zero conf",
TestFunc: testMultiHopReceiverPreimageClaimLeasedZeroConf,
},
{
Name: "multihop local force close before timeout anchor",
Name: "local force close before timeout anchor",
TestFunc: testLocalForceCloseBeforeTimeoutAnchor,
},
{
Name: "multihop local force close before timeout anchor zero conf",
Name: "local force close before timeout anchor zero conf",
TestFunc: testLocalForceCloseBeforeTimeoutAnchorZeroConf,
},
{
Name: "multihop local force close before timeout simple taproot",
Name: "local force close before timeout simple taproot",
TestFunc: testLocalForceCloseBeforeTimeoutSimpleTaproot,
},
{
Name: "multihop local force close before timeout simple taproot zero conf",
Name: "local force close before timeout simple taproot zero conf",
TestFunc: testLocalForceCloseBeforeTimeoutSimpleTaprootZeroConf,
},
{
Name: "multihop local force close before timeout leased",
Name: "local force close before timeout leased",
TestFunc: testLocalForceCloseBeforeTimeoutLeased,
},
{
Name: "multihop local force close before timeout leased zero conf",
Name: "local force close before timeout leased zero conf",
TestFunc: testLocalForceCloseBeforeTimeoutLeasedZeroConf,
},
{
Name: "multihop remote force close before timeout anchor",
Name: "remote force close before timeout anchor",
TestFunc: testRemoteForceCloseBeforeTimeoutAnchor,
},
{
Name: "multihop remote force close before timeout anchor zero conf",
Name: "remote force close before timeout anchor zero conf",
TestFunc: testRemoteForceCloseBeforeTimeoutAnchorZeroConf,
},
{
Name: "multihop remote force close before timeout simple taproot",
Name: "remote force close before timeout simple taproot",
TestFunc: testRemoteForceCloseBeforeTimeoutSimpleTaproot,
},
{
Name: "multihop remote force close before timeout simple taproot zero conf",
Name: "remote force close before timeout simple taproot zero conf",
TestFunc: testRemoteForceCloseBeforeTimeoutSimpleTaprootZeroConf,
},
{
Name: "multihop remote force close before timeout leased",
Name: "remote force close before timeout leased",
TestFunc: testRemoteForceCloseBeforeTimeoutLeased,
},
{
Name: "multihop remote force close before timeout leased zero conf",
Name: "remote force close before timeout leased zero conf",
TestFunc: testRemoteForceCloseBeforeTimeoutLeasedZeroConf,
},
{
Name: "multihop local claim incoming htlc anchor",
Name: "local claim incoming htlc anchor",
TestFunc: testLocalClaimIncomingHTLCAnchor,
},
{
Name: "multihop local claim incoming htlc anchor zero conf",
Name: "local claim incoming htlc anchor zero conf",
TestFunc: testLocalClaimIncomingHTLCAnchorZeroConf,
},
{
Name: "multihop local claim incoming htlc simple taproot",
Name: "local claim incoming htlc simple taproot",
TestFunc: testLocalClaimIncomingHTLCSimpleTaproot,
},
{
Name: "multihop local claim incoming htlc simple taproot zero conf",
Name: "local claim incoming htlc simple taproot zero conf",
TestFunc: testLocalClaimIncomingHTLCSimpleTaprootZeroConf,
},
{
Name: "multihop local claim incoming htlc leased",
Name: "local claim incoming htlc leased",
TestFunc: testLocalClaimIncomingHTLCLeased,
},
{
Name: "multihop local claim incoming htlc leased zero conf",
Name: "local claim incoming htlc leased zero conf",
TestFunc: testLocalClaimIncomingHTLCLeasedZeroConf,
},
{
Name: "multihop local preimage claim anchor",
Name: "local preimage claim anchor",
TestFunc: testLocalPreimageClaimAnchor,
},
{
Name: "multihop local preimage claim anchor zero conf",
Name: "local preimage claim anchor zero conf",
TestFunc: testLocalPreimageClaimAnchorZeroConf,
},
{
Name: "multihop local preimage claim simple taproot",
Name: "local preimage claim simple taproot",
TestFunc: testLocalPreimageClaimSimpleTaproot,
},
{
Name: "multihop local preimage claim simple taproot zero conf",
Name: "local preimage claim simple taproot zero conf",
TestFunc: testLocalPreimageClaimSimpleTaprootZeroConf,
},
{
Name: "multihop local preimage claim leased",
Name: "local preimage claim leased",
TestFunc: testLocalPreimageClaimLeased,
},
{
Name: "multihop local preimage claim leased zero conf",
Name: "local preimage claim leased zero conf",
TestFunc: testLocalPreimageClaimLeasedZeroConf,
},
{
Name: "multihop htlc aggregation anchor",
Name: "htlc aggregation anchor",
TestFunc: testHtlcAggregaitonAnchor,
},
{
Name: "multihop htlc aggregation anchor zero conf",
Name: "htlc aggregation anchor zero conf",
TestFunc: testHtlcAggregaitonAnchorZeroConf,
},
{
Name: "multihop htlc aggregation simple taproot",
Name: "htlc aggregation simple taproot",
TestFunc: testHtlcAggregaitonSimpleTaproot,
},
{
Name: "multihop htlc aggregation simple taproot zero conf",
Name: "htlc aggregation simple taproot zero conf",
TestFunc: testHtlcAggregaitonSimpleTaprootZeroConf,
},
{
Name: "multihop htlc aggregation leased",
Name: "htlc aggregation leased",
TestFunc: testHtlcAggregaitonLeased,
},
{
Name: "multihop htlc aggregation leased zero conf",
Name: "htlc aggregation leased zero conf",
TestFunc: testHtlcAggregaitonLeasedZeroConf,
},
}

View File

@@ -21,23 +21,23 @@ import (
// policy fee behavior.
var channelFeePolicyTestCases = []*lntest.TestCase{
{
Name: "channel fee policy default",
Name: "default",
TestFunc: testChannelFeePolicyDefault,
},
{
Name: "channel fee policy base fee",
Name: "base fee",
TestFunc: testChannelFeePolicyBaseFee,
},
{
Name: "channel fee policy fee rate",
Name: "fee rate",
TestFunc: testChannelFeePolicyFeeRate,
},
{
Name: "channel fee policy base fee and fee rate",
Name: "base fee and fee rate",
TestFunc: testChannelFeePolicyBaseFeeAndFeeRate,
},
{
Name: "channel fee policy low base fee and fee rate",
Name: "low base fee and fee rate",
TestFunc: testChannelFeePolicyLowBaseFeeAndFeeRate,
},
}

View File

@@ -20,51 +20,51 @@ import (
// signer.
var remoteSignerTestCases = []*lntest.TestCase{
{
Name: "remote signer random seed",
Name: "random seed",
TestFunc: testRemoteSignerRadomSeed,
},
{
Name: "remote signer account import",
Name: "account import",
TestFunc: testRemoteSignerAccountImport,
},
{
Name: "remote signer channel open",
Name: "channel open",
TestFunc: testRemoteSignerChannelOpen,
},
{
Name: "remote signer funding input types",
Name: "funding input types",
TestFunc: testRemoteSignerChannelFundingInputTypes,
},
{
Name: "remote signer funding async payments",
Name: "funding async payments",
TestFunc: testRemoteSignerAsyncPayments,
},
{
Name: "remote signer funding async payments taproot",
Name: "funding async payments taproot",
TestFunc: testRemoteSignerAsyncPaymentsTaproot,
},
{
Name: "remote signer shared key",
Name: "shared key",
TestFunc: testRemoteSignerSharedKey,
},
{
Name: "remote signer bump fee",
Name: "bump fee",
TestFunc: testRemoteSignerBumpFee,
},
{
Name: "remote signer psbt",
Name: "psbt",
TestFunc: testRemoteSignerPSBT,
},
{
Name: "remote signer sign output raw",
Name: "sign output raw",
TestFunc: testRemoteSignerSignOutputRaw,
},
{
Name: "remote signer verify msg",
Name: "verify msg",
TestFunc: testRemoteSignerSignVerifyMsg,
},
{
Name: "remote signer taproot",
Name: "taproot",
TestFunc: testRemoteSignerTaproot,
},
}

View File

@@ -22,21 +22,21 @@ import (
var sendToRouteTestCases = []*lntest.TestCase{
{
Name: "single hop send to route sync",
Name: "single hop with sync",
TestFunc: func(ht *lntest.HarnessTest) {
// useStream: false, routerrpc: false.
testSingleHopSendToRouteCase(ht, false, false)
},
},
{
Name: "single hop send to route stream",
Name: "single hop with stream",
TestFunc: func(ht *lntest.HarnessTest) {
// useStream: true, routerrpc: false.
testSingleHopSendToRouteCase(ht, true, false)
},
},
{
Name: "single hop send to route v2",
Name: "single hop with v2",
TestFunc: func(ht *lntest.HarnessTest) {
// useStream: false, routerrpc: true.
testSingleHopSendToRouteCase(ht, false, true)

View File

@@ -31,15 +31,7 @@ import (
//nolint:ll
var walletImportAccountTestCases = []*lntest.TestCase{
{
Name: "wallet import account standard BIP-0044",
TestFunc: func(ht *lntest.HarnessTest) {
testWalletImportAccountScenario(
ht, walletrpc.AddressType_WITNESS_PUBKEY_HASH,
)
},
},
{
Name: "wallet import account standard BIP-0049",
Name: "standard BIP-0049",
TestFunc: func(ht *lntest.HarnessTest) {
testWalletImportAccountScenario(
ht, walletrpc.AddressType_NESTED_WITNESS_PUBKEY_HASH,
@@ -47,7 +39,7 @@ var walletImportAccountTestCases = []*lntest.TestCase{
},
},
{
Name: "wallet import account lnd BIP-0049 variant",
Name: "lnd BIP-0049 variant",
TestFunc: func(ht *lntest.HarnessTest) {
testWalletImportAccountScenario(
ht, walletrpc.AddressType_HYBRID_NESTED_WITNESS_PUBKEY_HASH,
@@ -55,7 +47,7 @@ var walletImportAccountTestCases = []*lntest.TestCase{
},
},
{
Name: "wallet import account standard BIP-0084",
Name: "standard BIP-0084",
TestFunc: func(ht *lntest.HarnessTest) {
testWalletImportAccountScenario(
ht, walletrpc.AddressType_WITNESS_PUBKEY_HASH,
@@ -63,7 +55,7 @@ var walletImportAccountTestCases = []*lntest.TestCase{
},
},
{
Name: "wallet import account standard BIP-0086",
Name: "standard BIP-0086",
TestFunc: func(ht *lntest.HarnessTest) {
testWalletImportAccountScenario(
ht, walletrpc.AddressType_TAPROOT_PUBKEY,

View File

@@ -23,15 +23,15 @@ import (
// watchtower client and server.
var watchtowerTestCases = []*lntest.TestCase{
{
Name: "watchtower revoked close retribution altruist",
Name: "revoked close retribution altruist",
TestFunc: testRevokedCloseRetributionAltruistWatchtower,
},
{
Name: "watchtower client session deletion",
Name: "client session deletion",
TestFunc: testTowerClientSessionDeletion,
},
{
Name: "watchtower client tower and session management",
Name: "client tower and session management",
TestFunc: testTowerClientTowerAndSessionManagement,
},
}