aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-05-03 08:58:48 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-05-03 08:58:56 -0400
commitddc0a600b38ac6cef044085cdee46649fc437562 (patch)
tree806c31d62ceee012f137470af372c5e3a318fddc /test/functional/test_framework/util.py
parent68ef9523d1bcd00afbccee2a6585c9f82ddcdb31 (diff)
parent2742c3428633b6ceaab6714635dc3adb74bf121b (diff)
downloadbitcoin-ddc0a600b38ac6cef044085cdee46649fc437562.tar.xz
Merge #18617: test: add factor option to adjust test timeouts
2742c3428633b6ceaab6714635dc3adb74bf121b test: add factor option to adjust test timeouts (Harris) Pull request description: This PR adds a new option **factor** that can be used to adjust timeouts in various functional tests. Several timeouts and functions from `authproxy`, `mininode`, `test_node` and `util` have been adapted to use this option. The factor-option definition is located in `test_framework.py`. Fixes https://github.com/bitcoin/bitcoin/issues/18266 Also Fixes https://github.com/bitcoin/bitcoin/issues/18834 ACKs for top commit: MarcoFalke: Thanks! ACK 2742c3428633b6ceaab6714635dc3adb74bf121b Tree-SHA512: 6d8421933ba2ac1b7db00b70cf2bc242d9842c48121c11aadc30b0985c4a174c86a127d6402d0cd73b993559d60d4f747872d21f9510cf4806e008349780d3ef
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r--test/functional/test_framework/util.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index eb9f6528b3..20ab9ee464 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -208,9 +208,10 @@ def str_to_b64str(string):
def satoshi_round(amount):
return Decimal(amount).quantize(Decimal('0.00000001'), rounding=ROUND_DOWN)
-def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=None):
+def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=None, factor=1.0):
if attempts == float('inf') and timeout == float('inf'):
timeout = 60
+ timeout = timeout * factor
attempt = 0
time_end = time.time() + timeout
@@ -265,7 +266,7 @@ def get_rpc_proxy(url, node_number, *, timeout=None, coveragedir=None):
"""
proxy_kwargs = {}
if timeout is not None:
- proxy_kwargs['timeout'] = timeout
+ proxy_kwargs['timeout'] = int(timeout)
proxy = AuthServiceProxy(url, **proxy_kwargs)
proxy.url = url # store URL on proxy for info