mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
pytest: Add throttler to limit load on the test system
Both my machine and apparently the CI tester machines regularly run into issues with load on the system, causing timeouts (and unresponsiveness). The throttler throttles the speed with which new instances of c-lightning get started to avoid overloading. Since the plugin used for parallelism when testing spawns multiple processes we need to lock on the fs. Since we have that file open already, we'll also write a couple of performance metics to it.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from concurrent import futures
|
||||
from pyln.testing.db import SqliteDbProvider, PostgresDbProvider
|
||||
from pyln.testing.utils import NodeFactory, BitcoinD, ElementsD, env, DEVELOPER, LightningNode, TEST_DEBUG
|
||||
from pyln.testing.utils import NodeFactory, BitcoinD, ElementsD, env, DEVELOPER, LightningNode, TEST_DEBUG, Throttler
|
||||
from typing import Dict
|
||||
|
||||
import logging
|
||||
@@ -198,7 +198,12 @@ def teardown_checks(request):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def node_factory(request, directory, test_name, bitcoind, executor, db_provider, teardown_checks, node_cls):
|
||||
def throttler():
|
||||
yield Throttler()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def node_factory(request, directory, test_name, bitcoind, executor, db_provider, teardown_checks, node_cls, throttler):
|
||||
nf = NodeFactory(
|
||||
request,
|
||||
test_name,
|
||||
@@ -206,7 +211,8 @@ def node_factory(request, directory, test_name, bitcoind, executor, db_provider,
|
||||
executor,
|
||||
directory=directory,
|
||||
db_provider=db_provider,
|
||||
node_cls=node_cls
|
||||
node_cls=node_cls,
|
||||
throttler=throttler,
|
||||
)
|
||||
|
||||
yield nf
|
||||
|
||||
Reference in New Issue
Block a user