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:
Boris Nagaev
2025-04-22 10:44:40 -03:00
parent 429000e360
commit 6451ce495a
3 changed files with 58 additions and 63 deletions

View File

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