Skip to content

Commit e79d5ab

Browse files
committed
itest: speed up test by skipping Alice+bob
1 parent 1e257d1 commit e79d5ab

File tree

5 files changed

+74
-68
lines changed

5 files changed

+74
-68
lines changed

itest/litd_custom_channels_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3948,18 +3948,6 @@ func testCustomChannelsDecodeAssetInvoice(ctx context.Context,
39483948
"rfqrpc://%s", oracleAddr,
39493949
))
39503950

3951-
// For this test, Zane will be our dedicated Universe server for all
3952-
// parties.
3953-
zane, err := net.NewNode(
3954-
t.t, "Zane", lndArgs, false, true, litdArgs...,
3955-
)
3956-
require.NoError(t.t, err)
3957-
3958-
litdArgs = append(litdArgs, fmt.Sprintf(
3959-
"--taproot-assets.proofcourieraddr=%s://%s",
3960-
proof.UniverseRpcCourierType, zane.Cfg.LitAddr(),
3961-
))
3962-
39633951
// We'll just make a single node here, as this doesn't actually rely on
39643952
// a set of active channels.
39653953
alice, err := net.NewNode(

itest/litd_test.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package itest
22

33
import (
4-
"fmt"
54
"os"
65
"strings"
76
"testing"
@@ -42,8 +41,6 @@ func TestLightningTerminal(t *testing.T) {
4241

4342
// Run the subset of the test cases selected in this tranche.
4443
for _, testCase := range allTestCases {
45-
testCase := testCase
46-
4744
success := t.Run(testCase.name, func(t1 *testing.T) {
4845
cleanTestCaseName := strings.ReplaceAll(
4946
testCase.name, " ", "_",
@@ -79,24 +76,9 @@ func TestLightningTerminal(t *testing.T) {
7976

8077
err = litdHarness.SetUp(
8178
t1, cleanTestCaseName, aliceBobArgs,
79+
testCase.noAliceBob,
8280
)
8381
require.NoError(t1, err, "harness setup failed")
84-
t1.Cleanup(func() {
85-
require.NoError(t1, litdHarness.TearDown())
86-
litdHarness.Stop()
87-
})
88-
89-
litdHarness.EnsureConnected(
90-
t1, litdHarness.Alice, litdHarness.Bob,
91-
)
92-
93-
logLine := fmt.Sprintf(
94-
"STARTING ============ %v ============\n",
95-
testCase.name,
96-
)
97-
98-
litdHarness.Alice.AddToLog(logLine)
99-
litdHarness.Bob.AddToLog(logLine)
10082

10183
// Create a separate harness test for the testcase to
10284
// avoid overwriting the external harness test that is

itest/litd_test_list_on_test.go

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,83 +5,98 @@ package itest
55

66
var allTestCases = []*testCase{
77
{
8-
name: "test mode integrated",
8+
name: "integrated mode",
99
test: testModeIntegrated,
1010
},
1111
{
12-
name: "test mode remote",
12+
name: "remote mode",
1313
test: testModeRemote,
1414
},
1515
{
1616
name: "stateless init mode",
1717
test: testStatelessInitMode,
1818
},
1919
{
20-
name: "test firewall rules",
20+
name: "firewall rules",
2121
test: testFirewallRules,
2222
},
2323
{
24-
name: "test large http header",
24+
name: "large http header",
2525
test: testLargeHttpHeader,
2626
},
2727
{
28-
name: "test custom channels",
29-
test: testCustomChannels,
28+
name: "custom channels",
29+
test: testCustomChannels,
30+
noAliceBob: true,
3031
},
3132
{
32-
name: "test custom channels large",
33-
test: testCustomChannelsLarge,
33+
name: "custom channels large",
34+
test: testCustomChannelsLarge,
35+
noAliceBob: true,
3436
},
3537
{
36-
name: "test custom channels grouped asset",
37-
test: testCustomChannelsGroupedAsset,
38+
name: "custom channels grouped asset",
39+
test: testCustomChannelsGroupedAsset,
40+
noAliceBob: true,
3841
},
3942
{
40-
name: "test custom channels force close",
41-
test: testCustomChannelsForceClose,
43+
name: "custom channels force close",
44+
test: testCustomChannelsForceClose,
45+
noAliceBob: true,
4246
},
4347
{
44-
name: "test custom channels breach",
45-
test: testCustomChannelsBreach,
48+
name: "custom channels breach",
49+
test: testCustomChannelsBreach,
50+
noAliceBob: true,
4651
},
4752
{
48-
name: "test custom channels liquidity",
49-
test: testCustomChannelsLiquidityEdgeCases,
53+
name: "custom channels liquidity",
54+
test: testCustomChannelsLiquidityEdgeCases,
55+
noAliceBob: true,
5056
},
5157
{
52-
name: "test custom channels htlc force close",
53-
test: testCustomChannelsHtlcForceClose,
58+
name: "custom channels htlc force close",
59+
test: testCustomChannelsHtlcForceClose,
60+
noAliceBob: true,
5461
},
5562
{
56-
name: "test custom channels htlc force close MPP",
57-
test: testCustomChannelsHtlcForceCloseMpp,
63+
name: "custom channels htlc force close MPP",
64+
test: testCustomChannelsHtlcForceCloseMpp,
65+
noAliceBob: true,
5866
},
5967
{
60-
name: "test custom channels balance consistency",
61-
test: testCustomChannelsBalanceConsistency,
68+
name: "custom channels balance consistency",
69+
test: testCustomChannelsBalanceConsistency,
70+
noAliceBob: true,
6271
},
6372
{
64-
name: "test custom channels single asset multi input",
65-
test: testCustomChannelsSingleAssetMultiInput,
73+
name: "custom channels single asset multi input",
74+
test: testCustomChannelsSingleAssetMultiInput,
75+
noAliceBob: true,
6676
},
6777
{
68-
name: "test custom channels oracle pricing",
69-
test: testCustomChannelsOraclePricing,
78+
name: "custom channels oracle pricing",
79+
test: testCustomChannelsOraclePricing,
80+
noAliceBob: true,
7081
},
7182
{
72-
name: "test custom channels fee",
73-
test: testCustomChannelsFee,
83+
name: "custom channels fee",
84+
test: testCustomChannelsFee,
85+
noAliceBob: true,
7486
},
7587
{
76-
name: "test custom channels forward bandwidth",
77-
test: testCustomChannelsForwardBandwidth,
88+
name: "custom channels forward bandwidth",
89+
test: testCustomChannelsForwardBandwidth,
90+
noAliceBob: true,
7891
},
7992
{
80-
name: "test custom channels strict forwarding",
81-
test: testCustomChannelsStrictForwarding,
93+
name: "custom channels strict forwarding",
94+
test: testCustomChannelsStrictForwarding,
95+
noAliceBob: true,
8296
},
8397
{
84-
name: "test custom channels decode payreq",
85-
test: testCustomChannelsDecodeAssetInvoice,
98+
name: "custom channels decode payreq",
99+
test: testCustomChannelsDecodeAssetInvoice,
100+
noAliceBob: true,
86101
},
87102
}

itest/network_harness.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ func (n *NetworkHarness) ProcessErrors() <-chan error {
122122
// rpc clients capable of communicating with the initial seeder nodes are
123123
// created. Nodes are initialized with the given extra command line flags, which
124124
// should be formatted properly - "--arg=value".
125-
func (n *NetworkHarness) SetUp(t *testing.T,
126-
testCase string, lndArgs []string) error {
125+
func (n *NetworkHarness) SetUp(t *testing.T, testCase string, lndArgs []string,
126+
noAliceBob bool) error {
127127

128128
// Swap out grpc's default logger with our fake logger which drops the
129129
// statements on the floor.
@@ -143,6 +143,11 @@ func (n *NetworkHarness) SetUp(t *testing.T,
143143
n.autopilotServer = mock.NewServer()
144144
require.NoError(t, n.autopilotServer.Start())
145145

146+
// Skip early if we don't need the default Alice and Bob nodes.
147+
if noAliceBob {
148+
return nil
149+
}
150+
146151
// Start the initial seeder nodes within the test network, then connect
147152
// their respective RPC clients.
148153
eg := errgroup.Group{}
@@ -252,6 +257,20 @@ out:
252257
}
253258
}
254259

260+
t.Cleanup(func() {
261+
require.NoError(t, n.TearDown())
262+
n.Stop()
263+
})
264+
265+
n.EnsureConnected(t, n.Alice, n.Bob)
266+
267+
logLine := fmt.Sprintf(
268+
"STARTING ============ %v ============\n", testCase,
269+
)
270+
271+
n.Alice.AddToLog(logLine)
272+
n.Bob.AddToLog(logLine)
273+
255274
return nil
256275
}
257276

itest/test_harness.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ func getLitdBinary() string {
126126

127127
type testCase struct {
128128
name string
129-
test func(ctx context.Context, net *NetworkHarness, t *harnessTest)
129+
test func(ctx context.Context, net *NetworkHarness,
130+
t *harnessTest)
131+
noAliceBob bool
130132
}
131133

132134
// waitForNTxsInMempool polls until finding the desired number of transactions

0 commit comments

Comments
 (0)