diff --git a/lntest/itest/assertions.go b/lntest/itest/assertions.go new file mode 100644 index 000000000..84fc7949a --- /dev/null +++ b/lntest/itest/assertions.go @@ -0,0 +1,16 @@ +package itest + +import ( + "testing" + + "github.com/lightningnetwork/lnd/lntest" + "github.com/stretchr/testify/require" +) + +// AddToNodeLog adds a line to the log file and asserts there's no error. +func AddToNodeLog(t *testing.T, + node *lntest.HarnessNode, logLine string) { + + err := node.AddToLog(logLine) + require.NoError(t, err, "unable to add to log") +} diff --git a/lntest/itest/lnd_funding_test.go b/lntest/itest/lnd_funding_test.go index 6d2d791f6..b957205f7 100644 --- a/lntest/itest/lnd_funding_test.go +++ b/lntest/itest/lnd_funding_test.go @@ -137,6 +137,12 @@ test: "carol_commit=%v,dave_commit=%v", cc, dc, ) + logLine := fmt.Sprintf( + "---- basic channel funding subtest %s ----\n", + testName, + ) + AddToNodeLog(t.t, net.Alice, logLine) + success := t.t.Run(testName, func(t *testing.T) { testFunding(cc, dc) }) diff --git a/lntest/itest/lnd_multi-hop_test.go b/lntest/itest/lnd_multi-hop_test.go index 9a4819db0..7eee2c52e 100644 --- a/lntest/itest/lnd_multi-hop_test.go +++ b/lntest/itest/lnd_multi-hop_test.go @@ -102,6 +102,13 @@ func testMultiHopHtlcClaims(net *lntest.NetworkHarness, t *harnessTest) { for _, subTest := range subTests { subTest := subTest + logLine := fmt.Sprintf( + "---- multi-hop htlc subtest "+ + "%s/%s ----\n", + testName, subTest.name, + ) + AddToNodeLog(t, net.Alice, logLine) + success := ht.t.Run(subTest.name, func(t *testing.T) { ht := newHarnessTest(t, net) diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index d4b04a0fc..687827e3f 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -3153,6 +3153,11 @@ func testChannelForceClosure(net *lntest.NetworkHarness, t *harnessTest) { for _, channelType := range commitTypes { testName := fmt.Sprintf("committype=%v", channelType) + logLine := fmt.Sprintf( + "---- channel force close subtest %s ----\n", + testName, + ) + AddToNodeLog(t.t, net.Alice, logLine) channelType := channelType success := t.t.Run(testName, func(t *testing.T) { @@ -14476,11 +14481,8 @@ func TestLightningNetworkDaemon(t *testing.T) { testCase.name, ) - err = lndHarness.Alice.AddToLog(logLine) - require.NoError(t1, err, "unable to add to log") - - err = lndHarness.Bob.AddToLog(logLine) - require.NoError(t1, err, "unable to add to log") + AddToNodeLog(t, lndHarness.Alice, logLine) + AddToNodeLog(t, lndHarness.Bob, logLine) // Start every test with the default static fee estimate. lndHarness.SetFeeEstimate(12500)