mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 13:25:43 +01:00
pytest: Fix benchmarks after the fixture migration
This commit is contained in:
parent
59bdba6bac
commit
d590302523
@ -4,10 +4,8 @@ from time import time
|
|||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import pytest
|
import pytest
|
||||||
import random
|
import random
|
||||||
import utils
|
|
||||||
|
|
||||||
|
|
||||||
num_workers = 480
|
num_workers = 480
|
||||||
@ -21,25 +19,6 @@ def executor():
|
|||||||
ex.shutdown(wait=False)
|
ex.shutdown(wait=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
|
||||||
def bitcoind():
|
|
||||||
bitcoind = utils.BitcoinD(rpcport=28332)
|
|
||||||
bitcoind.start()
|
|
||||||
info = bitcoind.rpc.getblockchaininfo()
|
|
||||||
# Make sure we have segwit and some funds
|
|
||||||
if info['blocks'] < 432:
|
|
||||||
logging.debug("SegWit not active, generating some more blocks")
|
|
||||||
bitcoind.generate_block(432 - info['blocks'])
|
|
||||||
|
|
||||||
yield bitcoind
|
|
||||||
|
|
||||||
try:
|
|
||||||
bitcoind.rpc.stop()
|
|
||||||
except Exception:
|
|
||||||
bitcoind.proc.kill()
|
|
||||||
bitcoind.proc.wait()
|
|
||||||
|
|
||||||
|
|
||||||
def test_single_hop(node_factory, executor):
|
def test_single_hop(node_factory, executor):
|
||||||
l1 = node_factory.get_node()
|
l1 = node_factory.get_node()
|
||||||
l2 = node_factory.get_node()
|
l2 = node_factory.get_node()
|
||||||
@ -73,10 +52,7 @@ def test_single_hop(node_factory, executor):
|
|||||||
|
|
||||||
|
|
||||||
def test_single_payment(node_factory, benchmark):
|
def test_single_payment(node_factory, benchmark):
|
||||||
l1 = node_factory.get_node()
|
l1, l2 = node_factory.line_graph(2)
|
||||||
l2 = node_factory.get_node()
|
|
||||||
l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port)
|
|
||||||
l1.openchannel(l2, 4000000)
|
|
||||||
|
|
||||||
def do_pay(l1, l2):
|
def do_pay(l1, l2):
|
||||||
invoice = l2.rpc.invoice(1000, 'invoice-{}'.format(random.random()), 'desc')['bolt11']
|
invoice = l2.rpc.invoice(1000, 'invoice-{}'.format(random.random()), 'desc')['bolt11']
|
||||||
@ -95,10 +71,7 @@ def test_invoice(node_factory, benchmark):
|
|||||||
|
|
||||||
|
|
||||||
def test_pay(node_factory, benchmark):
|
def test_pay(node_factory, benchmark):
|
||||||
l1 = node_factory.get_node()
|
l1, l2 = node_factory.line_graph(2)
|
||||||
l2 = node_factory.get_node()
|
|
||||||
l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port)
|
|
||||||
l1.openchannel(l2, 4000000)
|
|
||||||
|
|
||||||
invoices = []
|
invoices = []
|
||||||
for _ in range(1, 100):
|
for _ in range(1, 100):
|
||||||
|
@ -5,3 +5,5 @@ pytest-xdist==1.22.2
|
|||||||
flaky==3.4.0
|
flaky==3.4.0
|
||||||
CherryPy==17.3.0
|
CherryPy==17.3.0
|
||||||
Flask==1.0.2
|
Flask==1.0.2
|
||||||
|
pytest-benchmark==3.1.1
|
||||||
|
tqdm==4.26.0
|
||||||
|
Loading…
Reference in New Issue
Block a user