Skip to content

Commit 955ce78

Browse files
committed
itest: add LNC client logging
1 parent d5c2604 commit 955ce78

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

itest/litd_mode_integrated_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,10 @@ func runLNCAuthTest(t *testing.T, hostPort, tlsCertPath, macPath string,
612612
connectPhrase := strings.Split(
613613
sessResp.Session.PairingSecretMnemonic, " ",
614614
)
615+
616+
ctxt, cancel = context.WithTimeout(ctxb, defaultTimeout)
617+
defer cancel()
618+
615619
rawLNCConn, err := connectMailbox(ctxt, connectPhrase)
616620
require.NoError(t, err)
617621

itest/litd_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ import (
88
"time"
99

1010
"github.com/btcsuite/btcd/integration/rpctest"
11+
"github.com/lightninglabs/aperture"
12+
"github.com/lightninglabs/lightning-node-connect/gbn"
13+
"github.com/lightninglabs/lightning-node-connect/mailbox"
14+
"github.com/lightningnetwork/lnd"
15+
"github.com/lightningnetwork/lnd/build"
1116
"github.com/lightningnetwork/lnd/lntest"
17+
"github.com/lightningnetwork/lnd/signal"
1218
"github.com/stretchr/testify/require"
1319
)
1420

21+
var interceptor *signal.Interceptor
22+
1523
// TestLightningTerminal performs a series of integration tests amongst a
1624
// programmatically driven network of lnd nodes.
1725
func TestLightningTerminal(t *testing.T) {
@@ -73,6 +81,7 @@ func TestLightningTerminal(t *testing.T) {
7381
// Now we can set up our test harness (LND instance), with the chain
7482
// backend we just created.
7583
ht := newHarnessTest(t, nil)
84+
ht.setupLogging()
7685
binary := getLitdBinary()
7786
litdHarness, err = NewNetworkHarness(miner, chainBackend, binary)
7887
if err != nil {
@@ -164,3 +173,24 @@ func TestLightningTerminal(t *testing.T) {
164173
}
165174
}
166175
}
176+
177+
func (h *harnessTest) setupLogging() {
178+
logWriter := build.NewRotatingLogWriter()
179+
180+
if interceptor != nil {
181+
return
182+
}
183+
184+
ic, err := signal.Intercept()
185+
require.NoError(h.t, err)
186+
interceptor = &ic
187+
188+
aperture.SetupLoggers(logWriter, *interceptor)
189+
lnd.AddSubLogger(
190+
logWriter, mailbox.Subsystem, *interceptor, mailbox.UseLogger,
191+
)
192+
lnd.AddSubLogger(logWriter, gbn.Subsystem, *interceptor, gbn.UseLogger)
193+
194+
err = build.ParseAndSetDebugLevels("debug", logWriter)
195+
require.NoError(h.t, err)
196+
}

0 commit comments

Comments
 (0)