aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_multiwallet.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-03-22 10:18:33 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-03-22 10:31:44 +0100
commit185d48473e439743d68ede0208738f3a3e48bbce (patch)
tree69fadbead1cc8d10ec4c3e08f494cbce7b98cfd4 /test/functional/wallet_multiwallet.py
parentad823178e85aa070e5ec62799c17c36210b0dd7a (diff)
parentfae137454adc50a4e1d448ed7219a8f5344486c9 (diff)
downloadbitcoin-185d48473e439743d68ede0208738f3a3e48bbce.tar.xz
Merge #12718: [Tests] Require exact match in assert_start_raises_init_eror (jnewbery)
fae1374 qa: Allow for partial_match when checking init error (MarcoFalke) 5812273 [Tests] Require exact match in assert_start_raises_init_eror() (John Newbery) 0ec08a6 [Tests] Move assert_start_raises_init_error method to TestNode (John Newbery) Pull request description: Extracted from #12379, because the changes are important on their own. This allows for exact testing, since the match can be specified with a strict regex. Internal details (such as exact formatting of the error message) can still be fuzzed away by regex wildcards. Tree-SHA512: 605d2c9c42362a32d42321b066637577a026d0bb8cfc1c9f5737a4ca6503ffe85457a5122cea6e1101053ccc6c8aa1bbae3602e1fa7d2988bf7d5c275f412f66
Diffstat (limited to 'test/functional/wallet_multiwallet.py')
-rwxr-xr-xtest/functional/wallet_multiwallet.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py
index 378c06ee59..cf6d1274b5 100755
--- a/test/functional/wallet_multiwallet.py
+++ b/test/functional/wallet_multiwallet.py
@@ -7,6 +7,7 @@
Verify that a bitcoind node can load multiple wallet files
"""
import os
+import re
import shutil
from test_framework.test_framework import BitcoinTestFramework
@@ -60,29 +61,31 @@ class MultiWalletTest(BitcoinTestFramework):
assert_equal(os.path.isfile(wallet_dir(wallet_name)), True)
# should not initialize if wallet path can't be created
- self.assert_start_raises_init_error(0, ['-wallet=wallet.dat/bad'], 'Not a directory')
+ exp_stderr = "boost::filesystem::create_directory: (The system cannot find the path specified|Not a directory):"
+ self.nodes[0].assert_start_raises_init_error(['-wallet=wallet.dat/bad'], exp_stderr, partial_match=True)
- self.assert_start_raises_init_error(0, ['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" does not exist')
- self.assert_start_raises_init_error(0, ['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" is a relative path', cwd=data_dir())
- self.assert_start_raises_init_error(0, ['-walletdir=debug.log'], 'Error: Specified -walletdir "debug.log" is not a directory', cwd=data_dir())
+ self.nodes[0].assert_start_raises_init_error(['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" does not exist')
+ self.nodes[0].assert_start_raises_init_error(['-walletdir=wallets'], 'Error: Specified -walletdir "wallets" is a relative path', cwd=data_dir())
+ self.nodes[0].assert_start_raises_init_error(['-walletdir=debug.log'], 'Error: Specified -walletdir "debug.log" is not a directory', cwd=data_dir())
# should not initialize if there are duplicate wallets
- self.assert_start_raises_init_error(0, ['-wallet=w1', '-wallet=w1'], 'Error loading wallet w1. Duplicate -wallet filename specified.')
+ self.nodes[0].assert_start_raises_init_error(['-wallet=w1', '-wallet=w1'], 'Error: Error loading wallet w1. Duplicate -wallet filename specified.')
# should not initialize if one wallet is a copy of another
shutil.copyfile(wallet_dir('w8'), wallet_dir('w8_copy'))
- self.assert_start_raises_init_error(0, ['-wallet=w8', '-wallet=w8_copy'], 'duplicates fileid')
+ exp_stderr = "CDB: Can't open database w8_copy \(duplicates fileid \w+ from w8\)"
+ self.nodes[0].assert_start_raises_init_error(['-wallet=w8', '-wallet=w8_copy'], exp_stderr, partial_match=True)
# should not initialize if wallet file is a symlink
os.symlink('w8', wallet_dir('w8_symlink'))
- self.assert_start_raises_init_error(0, ['-wallet=w8_symlink'], 'Invalid -wallet path')
+ self.nodes[0].assert_start_raises_init_error(['-wallet=w8_symlink'], 'Error: Invalid -wallet path \'w8_symlink\'\. .*')
# should not initialize if the specified walletdir does not exist
- self.assert_start_raises_init_error(0, ['-walletdir=bad'], 'Error: Specified -walletdir "bad" does not exist')
+ self.nodes[0].assert_start_raises_init_error(['-walletdir=bad'], 'Error: Specified -walletdir "bad" does not exist')
# should not initialize if the specified walletdir is not a directory
not_a_dir = wallet_dir('notadir')
open(not_a_dir, 'a').close()
- self.assert_start_raises_init_error(0, ['-walletdir=' + not_a_dir], 'Error: Specified -walletdir "' + not_a_dir + '" is not a directory')
+ self.nodes[0].assert_start_raises_init_error(['-walletdir=' + not_a_dir], 'Error: Specified -walletdir "' + re.escape(not_a_dir) + '" is not a directory')
# if wallets/ doesn't exist, datadir should be the default wallet dir
wallet_dir2 = data_dir('walletdir')
@@ -102,8 +105,9 @@ class MultiWalletTest(BitcoinTestFramework):
competing_wallet_dir = os.path.join(self.options.tmpdir, 'competing_walletdir')
os.mkdir(competing_wallet_dir)
- self.restart_node(0, ['-walletdir='+competing_wallet_dir])
- self.assert_start_raises_init_error(1, ['-walletdir='+competing_wallet_dir], 'Error initializing wallet database environment')
+ self.restart_node(0, ['-walletdir=' + competing_wallet_dir])
+ exp_stderr = "Error: Error initializing wallet database environment \"\S+competing_walletdir\"!"
+ self.nodes[1].assert_start_raises_init_error(['-walletdir=' + competing_wallet_dir], exp_stderr, partial_match=True)
self.restart_node(0, extra_args)