Skip to content

Commit

Permalink
itest: test "lnd --debuglevel=show" command
Browse files Browse the repository at this point in the history
Tests that "lnd --debuglevel=show" command works and prints the list of
supported subsystems.
  • Loading branch information
starius committed Nov 18, 2024
1 parent 9811a19 commit 7456664
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,4 +702,8 @@ var allTestCases = []*lntest.TestCase{
Name: "send to route failed htlc timeout",
TestFunc: testSendToRouteFailHTLCTimeout,
},
{
Name: "debuglevel show",
TestFunc: testDebuglevelShow,
},
}
26 changes: 26 additions & 0 deletions itest/lnd_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package itest

import (
"os/exec"

"github.com/lightningnetwork/lnd/lntest"
"github.com/stretchr/testify/require"
)

// testDebuglevelShow tests that "lnd --debuglevel=show" command works and
// prints the list of supported subsystems.
func testDebuglevelShow(ht *lntest.HarnessTest) {
// We can't use ht.NewNode, because it adds more arguments to the
// command line (e.g. flags configuring bitcoin backend), but we want to
// make sure that "lnd --debuglevel=show" works without any other flags.
lndBinary := getLndBinary(ht.T)

Check failure on line 16 in itest/lnd_config.go

View workflow job for this annotation

GitHub Actions / run unit tests (btcd unit-cover)

undefined: getLndBinary
cmd := exec.Command(lndBinary, "--debuglevel=show")
stdoutStderrBytes, err := cmd.CombinedOutput()
require.NoError(ht.T, err, "failed to run 'lnd --debuglevel=show'")

// Make sure that the output contains the list of supported subsystems
// and that the list is not empty. We search PEER subsystem.
stdoutStderr := string(stdoutStderrBytes)
require.Contains(ht.T, stdoutStderr, "Supported subsystems")
require.Contains(ht.T, stdoutStderr, "PEER")
}

0 comments on commit 7456664

Please sign in to comment.