From ec04e1bee519ad4753cccc26ed5449d606a98f67 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 1 Feb 2021 18:07:40 +0100 Subject: [PATCH] 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. --- tests/test_connection.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index 811ecab4a..363abb7cc 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -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):