Skip to content

Commit becea48

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25034: test: add missing stop_node calls to feature_coinstatsindex and feature_prune
a3cd7db test: stop node before calling assert_start_raises_init_error (Martin Zumsande) Pull request description: In #24789, I forgot to stop the node before using `assert_start_raises_init_error` in `feature_coinstatsindex`. This resulted in a bitcoind process that is not being terminated after the test finishes. `feature_prune` has the same problem and also creates a zombie bitcoind process. Also adds an assert to `assert_start_raises_init_error` to make sure the node isn't already running to prevent this sort of mistake in the future. Top commit has no ACKs. Tree-SHA512: 902f683ebe7b19ca32ab83ca40d9698e9d91509b1d003f21a7221f79b647e05b6ef5c0c888fbb772cbca5e641d5c9437d522b6671f446c3ab321d79f7c6d0284
2 parents 26296eb + a3cd7db commit becea48

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

test/functional/feature_coinstatsindex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,13 @@ def _test_coin_stats_index(self):
231231

232232
self.log.info("Test that -reindex-chainstate is disallowed with coinstatsindex")
233233

234+
self.stop_node(1)
234235
self.nodes[1].assert_start_raises_init_error(
235236
expected_msg='Error: -reindex-chainstate option is not compatible with -coinstatsindex. '
236237
'Please temporarily disable coinstatsindex while using -reindex-chainstate, or replace -reindex-chainstate with -reindex to fully rebuild all indexes.',
237238
extra_args=['-coinstatsindex', '-reindex-chainstate'],
238239
)
240+
self.restart_node(1, extra_args=["-coinstatsindex"])
239241

240242
def _test_use_index_option(self):
241243
self.log.info("Test use_index option for nodes running the index")

test/functional/feature_pruning.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def create_big_chain(self):
125125
self.sync_blocks(self.nodes[0:5])
126126

127127
def test_invalid_command_line_options(self):
128+
self.stop_node(0)
128129
self.nodes[0].assert_start_raises_init_error(
129130
expected_msg='Error: Prune cannot be configured with a negative value.',
130131
extra_args=['-prune=-1'],

test/functional/test_framework/test_node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, mat
545545
546546
Will throw if bitcoind starts without an error.
547547
Will throw if an expected_msg is provided and it does not match bitcoind's stdout."""
548+
assert not self.running
548549
with tempfile.NamedTemporaryFile(dir=self.stderr_dir, delete=False) as log_stderr, \
549550
tempfile.NamedTemporaryFile(dir=self.stdout_dir, delete=False) as log_stdout:
550551
try:

0 commit comments

Comments
 (0)