diff options
author | Christian Decker <decker.christian@gmail.com> | 2021-04-06 13:06:41 +0200 |
---|---|---|
committer | Christian Decker <decker.christian@gmail.com> | 2021-06-03 14:49:15 +0200 |
commit | b9e76f1bf08c52fcd402b2314e00db4ad247ebc8 (patch) | |
tree | add130651eac6df1c4bb5cfc4fa4691ce783f039 /test | |
parent | f76cb10d7dc9a7b0c55d28011161606399417664 (diff) |
rpc: Add test for -rpcwaittimeout
Suggested-by: Jon Atack <@jonatack>
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/interface_bitcoin_cli.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/interface_bitcoin_cli.py b/test/functional/interface_bitcoin_cli.py index 30cd499b3f..22eec59600 100755 --- a/test/functional/interface_bitcoin_cli.py +++ b/test/functional/interface_bitcoin_cli.py @@ -10,10 +10,12 @@ from test_framework.blocktools import COINBASE_MATURITY from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, + assert_greater_than_or_equal, assert_raises_process_error, assert_raises_rpc_error, get_auth_cookie, ) +import time # The block reward of coinbaseoutput.nValue (50) BTC/block matures after # COINBASE_MATURITY (100) blocks. Therefore, after mining 101 blocks we expect @@ -248,6 +250,12 @@ class TestBitcoinCli(BitcoinTestFramework): self.nodes[0].wait_for_rpc_connection() assert_equal(blocks, BLOCKS + 25) + self.log.info("Test -rpcwait option waits at most -rpcwaittimeout seconds for startup") + self.stop_node(0) # stop the node so we time out + start_time = time.time() + assert_raises_process_error(1, "Could not connect to the server", self.nodes[0].cli('-rpcwait', '-rpcwaittimeout=5').echo) + assert_greater_than_or_equal(time.time(), start_time + 5) + if __name__ == '__main__': TestBitcoinCli().main() |