Skip to content

Commit e793268

Browse files
committed
itest: add mock autopilot server to network harness
1 parent ab347dd commit e793268

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

itest/network_harness.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/btcsuite/btcd/chaincfg/chainhash"
1919
"github.com/btcsuite/btcd/txscript"
2020
"github.com/btcsuite/btcd/wire"
21+
"github.com/lightninglabs/lightning-terminal/autopilotserver/mock"
2122
"github.com/lightningnetwork/lnd"
2223
"github.com/lightningnetwork/lnd/lnrpc"
2324
"github.com/lightningnetwork/lnd/lntest"
@@ -55,6 +56,8 @@ type NetworkHarness struct {
5556

5657
nodesByPub map[string]*HarnessNode
5758

59+
autopilotServer *mock.Server
60+
5861
// Alice and Bob are the initial seeder nodes that are automatically
5962
// created to be the initial participants of the test network.
6063
Alice *HarnessNode
@@ -130,6 +133,10 @@ func (n *NetworkHarness) SetUp(t *testing.T,
130133
err := n.server.start()
131134
require.NoError(t, err)
132135

136+
// Start a mock autopilot server.
137+
n.autopilotServer = mock.NewServer()
138+
require.NoError(t, n.autopilotServer.Start())
139+
133140
// Start the initial seeder nodes within the test network, then connect
134141
// their respective RPC clients.
135142
eg := errgroup.Group{}
@@ -260,6 +267,8 @@ func (n *NetworkHarness) TearDown() error {
260267
func (n *NetworkHarness) Stop() {
261268
close(n.lndErrorChan)
262269
close(n.quit)
270+
271+
n.autopilotServer.Stop()
263272
}
264273

265274
// NewNode initializes a new HarnessNode.
@@ -271,6 +280,11 @@ func (n *NetworkHarness) NewNode(t *testing.T, name string, extraArgs []string,
271280
fmt.Sprintf("--loop.server.tlspath=%s", n.server.certFile),
272281
fmt.Sprintf("--pool.auctionserver=%s", n.server.serverHost),
273282
fmt.Sprintf("--pool.tlspathauctserver=%s", n.server.certFile),
283+
"--autopilot.insecure",
284+
fmt.Sprintf(
285+
"--autopilot.address=localhost:%d",
286+
n.autopilotServer.GetPort(),
287+
),
274288
}
275289

276290
return n.newNode(

0 commit comments

Comments
 (0)