Skip to content

Commit

Permalink
rpc: Add test for -rpcwaittimeout
Browse files Browse the repository at this point in the history
Suggested-by: Jon Atack <@jonatack>
  • Loading branch information
cdecker committed Jun 3, 2021
1 parent f76cb10 commit b9e76f1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/functional/interface_bitcoin_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
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
Expand Down Expand Up @@ -248,6 +250,12 @@ def run_test(self):
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()

0 comments on commit b9e76f1

Please sign in to comment.