Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_filelock.py
Show All 18 Lines | def setup_network(self): | ||||
self.nodes[0].start() | self.nodes[0].start() | ||||
self.nodes[0].wait_for_rpc_connection() | self.nodes[0].wait_for_rpc_connection() | ||||
def run_test(self): | def run_test(self): | ||||
datadir = os.path.join(self.nodes[0].datadir, self.chain) | datadir = os.path.join(self.nodes[0].datadir, self.chain) | ||||
self.log.info(f"Using datadir {datadir}") | self.log.info(f"Using datadir {datadir}") | ||||
self.log.info( | self.log.info( | ||||
"Check that we can't start a second bitcoind instance using the same datadir") | "Check that we can't start a second bitcoind instance using the same" | ||||
" datadir" | |||||
) | |||||
expected_msg = ( | expected_msg = ( | ||||
f"Error: Cannot obtain a lock on data directory {datadir}. " | f"Error: Cannot obtain a lock on data directory {datadir}. " | ||||
f"{self.config['environment']['PACKAGE_NAME']} is probably already running." | f"{self.config['environment']['PACKAGE_NAME']} is probably already running." | ||||
) | ) | ||||
self.nodes[1].assert_start_raises_init_error( | self.nodes[1].assert_start_raises_init_error( | ||||
extra_args=[f'-datadir={self.nodes[0].datadir}', '-noserver'], | extra_args=[f"-datadir={self.nodes[0].datadir}", "-noserver"], | ||||
expected_msg=expected_msg) | expected_msg=expected_msg, | ||||
) | |||||
if self.is_wallet_compiled(): | if self.is_wallet_compiled(): | ||||
self.nodes[0].createwallet(self.default_wallet_name) | self.nodes[0].createwallet(self.default_wallet_name) | ||||
wallet_dir = os.path.join(datadir, 'wallets') | wallet_dir = os.path.join(datadir, "wallets") | ||||
self.log.info( | self.log.info( | ||||
"Check that we can't start a second bitcoind instance using the same wallet") | "Check that we can't start a second bitcoind instance using the same" | ||||
" wallet" | |||||
) | |||||
expected_msg = "Error: Error initializing wallet database environment" | expected_msg = "Error: Error initializing wallet database environment" | ||||
self.nodes[1].assert_start_raises_init_error( | self.nodes[1].assert_start_raises_init_error( | ||||
extra_args=[ | extra_args=[ | ||||
f'-walletdir={wallet_dir}', | f"-walletdir={wallet_dir}", | ||||
f'-wallet={self.default_wallet_name}', | f"-wallet={self.default_wallet_name}", | ||||
'-noserver'], | "-noserver", | ||||
], | |||||
expected_msg=expected_msg, | expected_msg=expected_msg, | ||||
match=ErrorMatch.PARTIAL_REGEX) | match=ErrorMatch.PARTIAL_REGEX, | ||||
) | |||||
if __name__ == '__main__': | if __name__ == "__main__": | ||||
FilelockTest().main() | FilelockTest().main() |