Browse Source

Merge #11091: test: Increase initial RPC timeout to 60 seconds

c1470a0 test: Increase initial RPC timeout to 60 seconds (Wladimir J. van der Laan)

Pull request description:

  When running the tests locally with a parallelism of 4 on an otherwise busy system, RPC can take quite a wait to come up.

  With the current timeout tests often fail with "Unable to connect to bitcoind".

  Change the timeout to 60 seconds just to be safe.

Tree-SHA512: 0c08cc8ce3f25ba2882beac2a50d1fcdd7c8c3bd6e3a8707813f94f2d39c14e2139ba1ddf7f9b66013d4c7f55db92d3f4aa88b433d855fd21e82842e350e459a
0.16
Wladimir J. van der Laan 7 years ago
parent
commit
a8532299d8
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
  1. 8
      test/functional/test_framework/test_node.py

8
test/functional/test_framework/test_node.py

@ -65,9 +65,9 @@ class TestNode():
def wait_for_rpc_connection(self): def wait_for_rpc_connection(self):
"""Sets up an RPC connection to the bitcoind process. Returns False if unable to connect.""" """Sets up an RPC connection to the bitcoind process. Returns False if unable to connect."""
timeout_s = 60 # Wait for up to 60 seconds for the RPC server to respond
# Wait for up to 10 seconds for the RPC server to respond poll_per_s = 4 # Poll at a rate of four times per second
for _ in range(40): for _ in range(timeout_s*poll_per_s):
assert not self.process.poll(), "bitcoind exited with status %i during initialization" % self.process.returncode assert not self.process.poll(), "bitcoind exited with status %i during initialization" % self.process.returncode
try: try:
self.rpc = get_rpc_proxy(rpc_url(self.datadir, self.index, self.rpchost), self.index, coveragedir=self.coverage_dir) self.rpc = get_rpc_proxy(rpc_url(self.datadir, self.index, self.rpchost), self.index, coveragedir=self.coverage_dir)
@ -86,7 +86,7 @@ class TestNode():
except ValueError as e: # cookie file not found and no rpcuser or rpcassword. bitcoind still starting except ValueError as e: # cookie file not found and no rpcuser or rpcassword. bitcoind still starting
if "No RPC credentials" not in str(e): if "No RPC credentials" not in str(e):
raise raise
time.sleep(0.25) time.sleep(1.0 / poll_per_s)
raise AssertionError("Unable to connect to bitcoind") raise AssertionError("Unable to connect to bitcoind")
def get_wallet_rpc(self, wallet_name): def get_wallet_rpc(self, wallet_name):

Loading…
Cancel
Save