Skip to content

Commit deba6fe

Browse files
committed
test: update feature_config_args.py
add two new test cases for conf and reindex
1 parent 2e3826c commit deba6fe

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/functional/feature_config_args.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,44 @@ def set_test_params(self):
2020
self.disable_autoconnect = False
2121

2222
def test_config_file_parser(self):
23+
self.log.info('Test config file parser')
2324
self.stop_node(0)
2425

26+
# Check that startup fails if conf= is set in bitcoin.conf or in an included conf file
27+
bad_conf_file_path = os.path.join(self.options.tmpdir, 'node0', 'bitcoin_bad.conf')
28+
util.write_config(bad_conf_file_path, n=0, chain='', extra_config=f'conf=some.conf\n')
29+
conf_in_config_file_err = 'Error: Error reading configuration file: conf cannot be set in the configuration file; use includeconf= if you want to include additional config files'
30+
self.nodes[0].assert_start_raises_init_error(
31+
extra_args=[f'-conf={bad_conf_file_path}'],
32+
expected_msg=conf_in_config_file_err,
33+
)
2534
inc_conf_file_path = os.path.join(self.nodes[0].datadir, 'include.conf')
2635
with open(os.path.join(self.nodes[0].datadir, 'bitcoin.conf'), 'a', encoding='utf-8') as conf:
2736
conf.write(f'includeconf={inc_conf_file_path}\n')
37+
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
38+
conf.write('conf=some.conf\n')
39+
self.nodes[0].assert_start_raises_init_error(
40+
expected_msg=conf_in_config_file_err,
41+
)
2842

2943
self.nodes[0].assert_start_raises_init_error(
3044
expected_msg='Error: Error parsing command line arguments: Invalid parameter -dash_cli=1',
3145
extra_args=['-dash_cli=1'],
3246
)
3347
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
3448
conf.write('dash_conf=1\n')
49+
3550
with self.nodes[0].assert_debug_log(expected_msgs=['Ignoring unknown configuration value dash_conf']):
3651
self.start_node(0)
3752
self.stop_node(0)
3853

54+
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
55+
conf.write('reindex=1\n')
56+
57+
with self.nodes[0].assert_debug_log(expected_msgs=['Warning: reindex=1 is set in the configuration file, which will significantly slow down startup. Consider removing or commenting out this option for better performance, unless there is currently a condition which makes rebuilding the indexes necessary']):
58+
self.start_node(0)
59+
self.stop_node(0)
60+
3961
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
4062
conf.write('-dash=1\n')
4163
self.nodes[0].assert_start_raises_init_error(expected_msg='Error: Error reading configuration file: parse error on line 1: -dash=1, options in configuration file must be specified without leading -')

0 commit comments

Comments
 (0)