mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
pytest: Stabilize funding cancel race by killing in parallel
It was using a trick to only shut down the first node, and forgetting about the others. This could lead to processes not being stopped correctly and to test failures because the directory isn't cleaned up correctly. Now we use the executor to shut as many nodes as possible in parallel.
This commit is contained in:
@@ -1162,11 +1162,8 @@ def test_funding_cancel_race(node_factory, bitcoind, executor):
|
||||
else:
|
||||
num = 100
|
||||
|
||||
nodes = node_factory.get_nodes(num)
|
||||
|
||||
# Speed up cleanup by not cleaning our test nodes: on my laptop, this goes
|
||||
# from 214 to 15 seconds
|
||||
node_factory.nodes = [l1]
|
||||
# Allow the other nodes to log unexpected WIRE_FUNDING_CREATED messages
|
||||
nodes = node_factory.get_nodes(num, opts={'allow_broken_log': True})
|
||||
|
||||
num_complete = 0
|
||||
num_cancel = 0
|
||||
@@ -1222,6 +1219,9 @@ def test_funding_cancel_race(node_factory, bitcoind, executor):
|
||||
assert num_cancel > 0
|
||||
assert num_complete > 0
|
||||
|
||||
# Speed up shutdown by stopping them all concurrently
|
||||
executor.map(lambda n: n.stop(), node_factory.nodes)
|
||||
|
||||
|
||||
@unittest.skipIf(TEST_NETWORK != 'regtest', "External wallet support doesn't work with elements yet.")
|
||||
def test_funding_close_upfront(node_factory, bitcoind):
|
||||
|
||||
Reference in New Issue
Block a user