aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-12-21 20:20:18 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-12-21 20:20:30 +0100
commitcc2a5ef9b2ffd25912f1840fe3f3ed4f66c9d559 (patch)
treefba3e04f3aeb91159ea390a462735b473cc0cd95 /test
parent2556a973ed5839c81ad23cc4d3f187f3a777483c (diff)
parentfab46b34f4b13abbb0af276c3fb548f25ccc28bd (diff)
downloadbitcoin-cc2a5ef9b2ffd25912f1840fe3f3ed4f66c9d559.tar.xz
Merge #20683: test: Fix restart node race
fab46b34f4b13abbb0af276c3fb548f25ccc28bd test: Fix restart node race (MarcoFalke) Pull request description: It is not allowed to start a node before it has been fully stopped. Otherwise it could lead to intermittent issues due to access issues (e.g. cookie file https://cirrus-ci.com/task/6409665024098304?command=ci#L4793) Fix that by waiting for the node to fully stop. ACKs for top commit: laanwj: code review ACK fab46b34f4b13abbb0af276c3fb548f25ccc28bd Tree-SHA512: 7605cac0573a7b04f05ff110d0131e8940d87f7baf6d698505ed16b363d4d15b1e552c5ffd1a187c8fe5639f7e265c3122734c85283275746e46bd789614fd21
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/test_framework/test_framework.py3
-rwxr-xr-xtest/functional/test_framework/test_node.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index bf047c5f68..85d448b2e8 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -517,13 +517,12 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
def stop_node(self, i, expected_stderr='', wait=0):
"""Stop a bitcoind test node"""
self.nodes[i].stop_node(expected_stderr, wait=wait)
- self.nodes[i].wait_until_stopped()
def stop_nodes(self, wait=0):
"""Stop multiple bitcoind test nodes"""
for node in self.nodes:
# Issue RPC to stop nodes
- node.stop_node(wait=wait)
+ node.stop_node(wait=wait, wait_until_stopped=False)
for node in self.nodes:
# Wait for nodes to stop
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index a618706a77..e10ec1328b 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -308,7 +308,7 @@ class TestNode():
def version_is_at_least(self, ver):
return self.version is None or self.version >= ver
- def stop_node(self, expected_stderr='', wait=0):
+ def stop_node(self, expected_stderr='', *, wait=0, wait_until_stopped=True):
"""Stop the node."""
if not self.running:
return
@@ -337,6 +337,9 @@ class TestNode():
del self.p2ps[:]
+ if wait_until_stopped:
+ self.wait_until_stopped()
+
def is_node_stopped(self):
"""Checks whether the node has stopped.