From ab422ba1845bed2ca3af64609412ea03b12b7195 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 15 Mar 2024 12:54:41 +0100 Subject: [PATCH] lntest: give chain backend more time to get ready This is a commit to attempt to fix Travis which runs on ARM64. --- lntest/harness_setup.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lntest/harness_setup.go b/lntest/harness_setup.go index 61eac5d2f..8aed3b880 100644 --- a/lntest/harness_setup.go +++ b/lntest/harness_setup.go @@ -7,6 +7,7 @@ import ( "github.com/btcsuite/btcd/integration/rpctest" "github.com/lightningnetwork/lnd/lntest/node" + "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" ) @@ -41,8 +42,15 @@ func SetupHarness(t *testing.T, binaryPath, dbBackendName string, ht.stopChainBackend = cleanUp // Connect our chainBackend to our miner. - t.Log("Connecting the miner with the chain backend...") - require.NoError(t, chainBackend.ConnectMiner(), "connect miner") + t.Logf("Connecting the miner at %v with the chain backend...", + miner.P2PAddress()) + + // Give the chain backend some time to fully start up, re-trying if any + // errors in connecting to the miner are encountered. + err := wait.NoError(func() error { + return chainBackend.ConnectMiner() + }, DefaultTimeout) + require.NoError(t, err, "connect miner") // Start the HarnessTest with the chainBackend and miner. ht.Start(chainBackend, miner)