mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
Merge pull request #6354 from guggero/fix-unit-tests
chainview: fix unit test timeout
This commit is contained in:
commit
51a7566248
@ -176,7 +176,11 @@ then watch it on chain. Taproot script spends are also supported through the
|
||||
* [The CI and build infrastructure for the project has transitioned to using Go 1.18](https://github.com/lightningnetwork/lnd/pull/6340).
|
||||
|
||||
* [Announce the keysend feature bit in NodeAnnouncement if `--accept-keysend`
|
||||
is set](https://github.com/lightningnetwork/lnd/pull/6414)
|
||||
is set](https://github.com/lightningnetwork/lnd/pull/6414).
|
||||
|
||||
* [Fix a flaky unit test in the `chainview`
|
||||
package](https://github.com/lightningnetwork/lnd/pull/6354).
|
||||
|
||||
|
||||
## RPC Server
|
||||
|
||||
|
@ -547,14 +547,23 @@ func testFilterBlockDisconnected(node *rpctest.Harness,
|
||||
}
|
||||
defer reorgNode.TearDown()
|
||||
|
||||
// We want to overwrite some of the connection settings to make the
|
||||
// tests more robust. We might need to restart the backend while there
|
||||
// are already blocks present, which will take a bit longer than the
|
||||
// 1 second the default settings amount to. Doubling both values will
|
||||
// give us retries up to 4 seconds.
|
||||
reorgNode.MaxConnRetries = rpctest.DefaultMaxConnectionRetries * 2
|
||||
reorgNode.ConnectionRetryTimeout = rpctest.DefaultConnectionRetryTimeout * 2
|
||||
|
||||
// This node's chain will be 105 blocks.
|
||||
if err := reorgNode.SetUp(true, 5); err != nil {
|
||||
t.Fatalf("unable to set up mining node: %v", err)
|
||||
}
|
||||
|
||||
// Init a chain view that has this node as its block source.
|
||||
cleanUpFunc, reorgView, err := chainViewInit(reorgNode.RPCConfig(),
|
||||
reorgNode.P2PAddress())
|
||||
cleanUpFunc, reorgView, err := chainViewInit(
|
||||
reorgNode.RPCConfig(), reorgNode.P2PAddress(),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create chain view: %v", err)
|
||||
}
|
||||
@ -775,7 +784,9 @@ var interfaceImpls = []struct {
|
||||
}{
|
||||
{
|
||||
name: "bitcoind_zmq",
|
||||
chainViewInit: func(_ rpcclient.ConnConfig, p2pAddr string) (func(), FilteredChainView, error) {
|
||||
chainViewInit: func(_ rpcclient.ConnConfig,
|
||||
p2pAddr string) (func(), FilteredChainView, error) {
|
||||
|
||||
// Start a bitcoind instance.
|
||||
tempBitcoindDir, err := ioutil.TempDir("", "bitcoind")
|
||||
if err != nil {
|
||||
@ -855,7 +866,9 @@ var interfaceImpls = []struct {
|
||||
},
|
||||
{
|
||||
name: "p2p_neutrino",
|
||||
chainViewInit: func(_ rpcclient.ConnConfig, p2pAddr string) (func(), FilteredChainView, error) {
|
||||
chainViewInit: func(_ rpcclient.ConnConfig,
|
||||
p2pAddr string) (func(), FilteredChainView, error) {
|
||||
|
||||
spvDir, err := ioutil.TempDir("", "neutrino")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -908,7 +921,9 @@ var interfaceImpls = []struct {
|
||||
},
|
||||
{
|
||||
name: "btcd_websockets",
|
||||
chainViewInit: func(config rpcclient.ConnConfig, _ string) (func(), FilteredChainView, error) {
|
||||
chainViewInit: func(config rpcclient.ConnConfig,
|
||||
_ string) (func(), FilteredChainView, error) {
|
||||
|
||||
blockCache := blockcache.NewBlockCache(10000)
|
||||
chainView, err := NewBtcdFilteredChainView(
|
||||
config, blockCache,
|
||||
@ -943,7 +958,9 @@ func TestFilteredChainView(t *testing.T) {
|
||||
t.Logf("Testing '%v' implementation of FilteredChainView",
|
||||
chainViewImpl.name)
|
||||
|
||||
cleanUpFunc, chainView, err := chainViewImpl.chainViewInit(rpcConfig, p2pAddr)
|
||||
cleanUpFunc, chainView, err := chainViewImpl.chainViewInit(
|
||||
rpcConfig, p2pAddr,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to make chain view: %v", err)
|
||||
}
|
||||
@ -955,8 +972,10 @@ func TestFilteredChainView(t *testing.T) {
|
||||
testName := fmt.Sprintf("%v: %v", chainViewImpl.name,
|
||||
chainViewTest.name)
|
||||
success := t.Run(testName, func(t *testing.T) {
|
||||
chainViewTest.test(miner, chainView,
|
||||
chainViewImpl.chainViewInit, t)
|
||||
chainViewTest.test(
|
||||
miner, chainView,
|
||||
chainViewImpl.chainViewInit, t,
|
||||
)
|
||||
})
|
||||
|
||||
if !success {
|
||||
|
Loading…
Reference in New Issue
Block a user