aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-08-01 14:37:47 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-08-01 14:37:07 -0400
commitfa5b440971a0dfdd64c1b86748a573fcd7dc65d3 (patch)
tree293c5d69fa9d0f2fb658ddd50da6b665f0175d41 /test
parentc88529a178d5ca719ebab597a4c4c3437327b2f6 (diff)
qa: Extract rpc_timewait as test param
Also increase it for wallet_dump and wallet_groups
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_dbcrash.py5
-rwxr-xr-xtest/functional/feature_pruning.py3
-rwxr-xr-xtest/functional/test_framework/test_framework.py7
-rwxr-xr-xtest/functional/test_framework/test_node.py8
-rwxr-xr-xtest/functional/wallet_dump.py9
-rwxr-xr-xtest/functional/wallet_groups.py1
6 files changed, 15 insertions, 18 deletions
diff --git a/test/functional/feature_dbcrash.py b/test/functional/feature_dbcrash.py
index cef257cf9b..a771118fd1 100755
--- a/test/functional/feature_dbcrash.py
+++ b/test/functional/feature_dbcrash.py
@@ -46,6 +46,8 @@ class ChainstateWriteCrashTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.setup_clean_chain = False
+ # Need a bit of extra time for the nodes to start up for this test
+ self.rpc_timewait = 90
# Set -maxmempool=0 to turn off mempool memory sharing with dbcache
# Set -rpcservertimeout=900 to reduce socket disconnects in this
@@ -63,8 +65,7 @@ class ChainstateWriteCrashTest(BitcoinTestFramework):
self.extra_args = [self.node0_args, self.node1_args, self.node2_args, self.node3_args]
def setup_network(self):
- # Need a bit of extra time for the nodes to start up for this test
- self.add_nodes(self.num_nodes, extra_args=self.extra_args, timewait=90)
+ self.add_nodes(self.num_nodes, extra_args=self.extra_args)
self.start_nodes()
# Leave them unconnected, we'll use submitblock directly in this test
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py
index d400507a66..147a0904be 100755
--- a/test/functional/feature_pruning.py
+++ b/test/functional/feature_pruning.py
@@ -28,6 +28,7 @@ class PruneTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 6
+ self.rpc_timewait = 900
# Create nodes 0 and 1 to mine.
# Create node 2 to test pruning.
@@ -54,7 +55,7 @@ class PruneTest(BitcoinTestFramework):
sync_blocks(self.nodes[0:5])
def setup_nodes(self):
- self.add_nodes(self.num_nodes, self.extra_args, timewait=900)
+ self.add_nodes(self.num_nodes, self.extra_args)
self.start_nodes()
def create_big_chain(self):
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index c2fb2077ac..ebdf4d18fd 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -86,6 +86,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self.nodes = []
self.network_thread = None
self.mocktime = 0
+ self.rpc_timewait = 60 # Wait for up to 60 seconds for the RPC server to respond
self.supports_cli = False
self.bind_to_localhost_only = True
self.set_test_params()
@@ -252,7 +253,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
# Public helper methods. These can be accessed by the subclass test scripts.
- def add_nodes(self, num_nodes, extra_args=None, rpchost=None, timewait=None, binary=None):
+ def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None):
"""Instantiate TestNode objects"""
if self.bind_to_localhost_only:
extra_confs = [["bind=127.0.0.1"]] * num_nodes
@@ -266,7 +267,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
assert_equal(len(extra_args), num_nodes)
assert_equal(len(binary), num_nodes)
for i in range(num_nodes):
- self.nodes.append(TestNode(i, get_datadir_path(self.options.tmpdir, i), rpchost=rpchost, timewait=timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
+ self.nodes.append(TestNode(i, get_datadir_path(self.options.tmpdir, i), rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
def start_node(self, i, *args, **kwargs):
"""Start a bitcoind"""
@@ -417,7 +418,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
args = [self.options.bitcoind, "-datadir=" + datadir]
if i > 0:
args.append("-connect=127.0.0.1:" + str(p2p_port(0)))
- self.nodes.append(TestNode(i, get_datadir_path(self.options.cachedir, i), extra_conf=["bind=127.0.0.1"], extra_args=[], rpchost=None, timewait=None, bitcoind=self.options.bitcoind, bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=None))
+ self.nodes.append(TestNode(i, get_datadir_path(self.options.cachedir, i), extra_conf=["bind=127.0.0.1"], extra_args=[], rpchost=None, timewait=self.rpc_timewait, bitcoind=self.options.bitcoind, bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=None))
self.nodes[i].args = args
self.start_node(i)
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 50942aec40..0c9f92448b 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -56,17 +56,13 @@ class TestNode():
To make things easier for the test writer, any unrecognised messages will
be dispatched to the RPC connection."""
- def __init__(self, i, datadir, rpchost, timewait, bitcoind, bitcoin_cli, mocktime, coverage_dir, extra_conf=None, extra_args=None, use_cli=False):
+ def __init__(self, i, datadir, *, rpchost, timewait, bitcoind, bitcoin_cli, mocktime, coverage_dir, extra_conf=None, extra_args=None, use_cli=False):
self.index = i
self.datadir = datadir
self.stdout_dir = os.path.join(self.datadir, "stdout")
self.stderr_dir = os.path.join(self.datadir, "stderr")
self.rpchost = rpchost
- if timewait:
- self.rpc_timeout = timewait
- else:
- # Wait for up to 60 seconds for the RPC server to respond
- self.rpc_timeout = 60
+ self.rpc_timeout = timewait
self.binary = bitcoind
self.coverage_dir = coverage_dir
if extra_conf != None:
diff --git a/test/functional/wallet_dump.py b/test/functional/wallet_dump.py
index ba420ab2a6..cc0aca0df8 100755
--- a/test/functional/wallet_dump.py
+++ b/test/functional/wallet_dump.py
@@ -81,16 +81,13 @@ class WalletDumpTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.extra_args = [["-keypool=90", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"]]
+ self.rpc_timeout = 120
def setup_network(self, split=False):
- # Use 1 minute timeout because the initial getnewaddress RPC can take
- # longer than the default 30 seconds due to an expensive
- # CWallet::TopUpKeyPool call, and the encryptwallet RPC made later in
- # the test often takes even longer.
- self.add_nodes(self.num_nodes, extra_args=self.extra_args, timewait=60)
+ self.add_nodes(self.num_nodes, extra_args=self.extra_args)
self.start_nodes()
- def run_test (self):
+ def run_test(self):
wallet_unenc_dump = os.path.join(self.nodes[0].datadir, "wallet.unencrypted.dump")
wallet_enc_dump = os.path.join(self.nodes[0].datadir, "wallet.encrypted.dump")
diff --git a/test/functional/wallet_groups.py b/test/functional/wallet_groups.py
index 408e9dfef0..9fa7eaf07e 100755
--- a/test/functional/wallet_groups.py
+++ b/test/functional/wallet_groups.py
@@ -22,6 +22,7 @@ class WalletGroupTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 3
self.extra_args = [[], [], ['-avoidpartialspends']]
+ self.rpc_timewait = 120
def run_test (self):
# Mine some coins