Skip to content

Commit e8f6a48

Browse files
committedMar 18, 2025
Merge bitcoin#32057: test: avoid disk space warning for non-regtest
20fe41e test: avoid disk space warning for non-regtest (Sjors Provoost) Pull request description: `feature_config_args.py` incorrectly assumed that its testnet4 node would not log a disk space warning. But when bitcoin#31978 increased `m_assumed_blockchain_size` on testnet4 from 1 to 11 GiB, it triggered this bug on my RAM disk, see https://github.com/bitcoin/bitcoin/tree/master/test#speed-up-test-runs-with-a-ram-disk This PR fixes the issue by using `-prune` which prevents the warning. ACKs for top commit: fjahr: ACK 20fe41e maflcko: lgtm ACK 20fe41e rkrux: ACK 20fe41e Tree-SHA512: f4bbb3ede307e06bf097a3cf7a4099eacc9388e33f551e1d0c4c5f53747bfa593a4b22e5d2e713ce6dd8adf91602fade36fbec9cfc2b250a6b1cf09f11bc8473
2 parents 223fc24 + 20fe41e commit e8f6a48

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed
 

‎test/functional/feature_config_args.py

+6-14
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ def add_options(self, parser):
2424
def set_test_params(self):
2525
self.setup_clean_chain = True
2626
self.num_nodes = 1
27+
# Prune to prevent disk space warning on CI systems with limited space,
28+
# when using networks other than regtest.
29+
self.extra_args = [["-prune=550"]]
2730
self.supports_cli = False
2831
self.wallet_names = []
2932
self.disable_autoconnect = False
@@ -471,32 +474,21 @@ def test_testnet3_deprecation_msg(self):
471474
self.log.info("Test testnet3 deprecation warning")
472475
t3_warning_log = "Warning: Support for testnet3 is deprecated and will be removed in an upcoming release. Consider switching to testnet4."
473476

474-
def warning_msg(node, approx_size):
475-
return f'Warning: Disk space for "{node.datadir_path / node.chain / "blocks" }" may not accommodate the block files. Approximately {approx_size} GB of data will be stored in this directory.'
476-
477-
# Testnet3 node will log the warning
477+
self.log.debug("Testnet3 node will log the deprecation warning")
478478
self.nodes[0].chain = 'testnet3'
479479
self.nodes[0].replace_in_config([('regtest=', 'testnet='), ('[regtest]', '[test]')])
480480
with self.nodes[0].assert_debug_log([t3_warning_log]):
481481
self.start_node(0)
482-
# Some CI environments will have limited space and some others won't
483-
# so we need to handle both cases as a valid result.
484-
self.nodes[0].stderr.seek(0)
485-
err = self.nodes[0].stdout.read()
486-
self.nodes[0].stderr.seek(0)
487-
self.nodes[0].stderr.truncate()
488-
if err != b'' and err != warning_msg(self.nodes[0], 42):
489-
raise AssertionError("Unexpected stderr after shutdown of Testnet3 node")
490482
self.stop_node(0)
491483

492-
# Testnet4 node will not log the warning
484+
self.log.debug("Testnet4 node will not log the deprecation warning")
493485
self.nodes[0].chain = 'testnet4'
494486
self.nodes[0].replace_in_config([('testnet=', 'testnet4='), ('[test]', '[testnet4]')])
495487
with self.nodes[0].assert_debug_log([], unexpected_msgs=[t3_warning_log]):
496488
self.start_node(0)
497489
self.stop_node(0)
498490

499-
# Reset to regtest
491+
self.log.debug("Reset to regtest")
500492
self.nodes[0].chain = 'regtest'
501493
self.nodes[0].replace_in_config([('testnet4=', 'regtest='), ('[testnet4]', '[regtest]')])
502494

‎test/functional/feature_signet.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626

2727
class SignetParams:
2828
def __init__(self, challenge=None):
29+
# Prune to prevent disk space warning on CI systems with limited space,
30+
# when using networks other than regtest.
2931
if challenge is None:
3032
self.challenge = SIGNET_DEFAULT_CHALLENGE
31-
self.shared_args = []
33+
self.shared_args = ["-prune=550"]
3234
else:
3335
self.challenge = challenge
34-
self.shared_args = [f"-signetchallenge={challenge}"]
36+
self.shared_args = ["-prune=550", f"-signetchallenge={challenge}"]
3537

3638
class SignetBasicTest(BitcoinTestFramework):
3739
def set_test_params(self):

0 commit comments

Comments
 (0)
Please sign in to comment.