Skip to content

Commit 40310f5

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#21792: test: Fix intermittent issue in p2p_segwit.py
fad6269 test: Assert that exit code indicates failure (MarcoFalke) faecb72 test: Fix intermittent issue in p2p_segwit.py (MarcoFalke) Pull request description: Calling `start_node` might call `wait_for_rpc_connection`, which will fail. https://cirrus-ci.com/task/5669555591708672?logs=ci#L3504 ``` File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_segwit.py", line 1974, in test_upgrade_after_activation self.start_node(2, extra_args=["-reindex", f"-segwitheight={SEGWIT_HEIGHT}"]) File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 508, in start_node node.wait_for_rpc_connection() File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_node.py", line 224, in wait_for_rpc_connection raise FailedToStartError(self._node_msg( test_framework.test_node.FailedToStartError: [node 2] bitcoind exited with status 1 during initialization ACKs for top commit: jnewbery: ACK fad6269 dhruv: ACK fad6269 Tree-SHA512: 4c5e39ce25e135717ea433258518f93f09d1c528c4538a8627d3da13bc0c0ba4b45911703c26392ff0f5e0cb7831a6c7cc53e6e29102d3da9c8cfce7cef333cc
2 parents d9ae6ec + fad6269 commit 40310f5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

test/functional/p2p_segwit.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,9 +1966,10 @@ def test_upgrade_after_activation(self):
19661966
# Restarting node 2 should result in a shutdown because the blockchain consists of
19671967
# insufficiently validated blocks per segwit consensus rules.
19681968
self.stop_node(2)
1969-
with self.nodes[2].assert_debug_log(expected_msgs=[
1970-
f"Witness data for blocks after height {SEGWIT_HEIGHT} requires validation. Please restart with -reindex."], timeout=10):
1971-
self.nodes[2].start([f"-segwitheight={SEGWIT_HEIGHT}"])
1969+
self.nodes[2].assert_start_raises_init_error(
1970+
extra_args=[f"-segwitheight={SEGWIT_HEIGHT}"],
1971+
expected_msg=f": Witness data for blocks after height {SEGWIT_HEIGHT} requires validation. Please restart with -reindex..\nPlease restart with -reindex or -reindex-chainstate to recover.",
1972+
)
19721973

19731974
# As directed, the user restarts the node with -reindex
19741975
self.start_node(2, extra_args=["-reindex", f"-segwitheight={SEGWIT_HEIGHT}"])

test/functional/test_framework/test_node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, mat
491491
self.start(extra_args, stdout=log_stdout, stderr=log_stderr, *args, **kwargs)
492492
ret = self.process.wait(timeout=self.rpc_timeout)
493493
self.log.debug(self._node_msg(f'bitcoind exited with status {ret} during initialization'))
494+
assert ret != 0 # Exit code must indicate failure
494495
self.running = False
495496
self.process = None
496497
# Check stderr for expected message

0 commit comments

Comments
 (0)