aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_config_args.py
diff options
context:
space:
mode:
authorAkio Nakamura <nakamura@dgtechnologies.co.jp>2019-02-04 12:53:19 +0900
committerAkio Nakamura <nakamura@dgtechnologies.co.jp>2019-02-19 10:49:19 +0900
commit1a7ba84e1194aeeb3c2fc9d79337a84586b834fd (patch)
tree806c355c4d3c01bfa2d6192007f221f206d3082a /test/functional/feature_config_args.py
parent904308dca3ff50afb704597c0a65d226dd40f635 (diff)
downloadbitcoin-1a7ba84e1194aeeb3c2fc9d79337a84586b834fd.tar.xz
Fix lack of warning of unrecognized section names
1. Fix lack of warning by collecting all section names by moving m_config_sections.clear() to ArgsManager::ReadConfigFiles(). 2. Add info(file name, line number) to warning message. 3. Add a test code to confirm this situation. 3. Do clear() in ReadConfigString().
Diffstat (limited to 'test/functional/feature_config_args.py')
-rwxr-xr-xtest/functional/feature_config_args.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py
index 4b3f6603a2..460e664c48 100755
--- a/test/functional/feature_config_args.py
+++ b/test/functional/feature_config_args.py
@@ -41,13 +41,21 @@ class ConfArgsTest(BitcoinTestFramework):
conf.write('server=1\nrpcuser=someuser\n[main]\nrpcpassword=some#pass')
self.nodes[0].assert_start_raises_init_error(expected_msg='Error reading configuration file: parse error on line 4, using # in rpcpassword can be ambiguous and should be avoided')
+ inc_conf_file2_path = os.path.join(self.nodes[0].datadir, 'include2.conf')
+ with open(os.path.join(self.nodes[0].datadir, 'bitcoin.conf'), 'a', encoding='utf-8') as conf:
+ conf.write('includeconf={}\n'.format(inc_conf_file2_path))
+
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
- conf.write('testnot.datadir=1\n[testnet]\n')
+ conf.write('testnot.datadir=1\n')
+ with open(inc_conf_file2_path, 'w', encoding='utf-8') as conf:
+ conf.write('[testnet]\n')
self.restart_node(0)
- self.nodes[0].stop_node(expected_stderr='Warning: Section [testnet] is not recognized.' + os.linesep + 'Warning: Section [testnot] is not recognized.')
+ self.nodes[0].stop_node(expected_stderr='Warning: ' + inc_conf_file_path + ':1 Section [testnot] is not recognized.' + os.linesep + 'Warning: ' + inc_conf_file2_path + ':1 Section [testnet] is not recognized.')
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
conf.write('') # clear
+ with open(inc_conf_file2_path, 'w', encoding='utf-8') as conf:
+ conf.write('') # clear
def run_test(self):
self.stop_node(0)