Skip to content

Commit 8a9817d

Browse files
committed
[tests] Use regtest section in functional tests configs
1 parent 30f9407 commit 8a9817d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

test/functional/feature_config_args.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ def run_test(self):
2929

3030
# Check that using non-existent datadir in conf file fails
3131
conf_file = os.path.join(default_data_dir, "bitcoin.conf")
32-
with open(conf_file, 'a', encoding='utf8') as f:
32+
33+
# datadir needs to be set before [regtest] section
34+
conf_file_contents = open(conf_file, encoding='utf8').read()
35+
with open(conf_file, 'w', encoding='utf8') as f:
3336
f.write("datadir=" + new_data_dir + "\n")
37+
f.write(conf_file_contents)
38+
3439
self.nodes[0].assert_start_raises_init_error(['-conf=' + conf_file], 'Error reading configuration file: specified data directory "' + new_data_dir + '" does not exist.')
3540

3641
# Create the directory and ensure the config file now works

test/functional/test_framework/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ def initialize_datadir(dirname, n):
294294
os.makedirs(datadir)
295295
with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
296296
f.write("regtest=1\n")
297+
f.write("[regtest]\n")
297298
f.write("port=" + str(p2p_port(n)) + "\n")
298299
f.write("rpcport=" + str(rpc_port(n)) + "\n")
299300
f.write("server=1\n")

0 commit comments

Comments
 (0)