test: add coverage for bitcoin-cli -rpcwait

in interface_bitcoin_cli.py
This commit is contained in:
Jon Atack 2020-04-15 15:03:28 +02:00
parent 20c0e2e0f0
commit 727b67e7b8
No known key found for this signature in database
GPG key ID: 4F5721B3D0E3921D

View file

@ -70,6 +70,7 @@ class TestBitcoinCli(BitcoinTestFramework):
assert_equal(cli_get_info['proxy'], network_info['networks'][0]['proxy'])
assert_equal(cli_get_info['difficulty'], blockchain_info['difficulty'])
assert_equal(cli_get_info['chain'], blockchain_info['chain'])
if self.is_wallet_compiled():
self.log.info("Test that -getinfo returns the expected wallet info")
assert_equal(cli_get_info['balance'], BALANCE)
@ -81,6 +82,17 @@ class TestBitcoinCli(BitcoinTestFramework):
else:
self.log.info("*** Wallet not compiled; -getinfo wallet tests skipped")
self.stop_node(0)
self.log.info("Test -rpcwait option waits for RPC connection instead of failing")
# Start node without RPC connection.
self.nodes[0].start()
# Verify failure without -rpcwait.
assert_raises_process_error(1, "Could not connect to the server", self.nodes[0].cli('getblockcount').echo)
# Verify success using -rpcwait.
assert_equal(BLOCKS, self.nodes[0].cli('-rpcwait', 'getblockcount').send_cli())
self.nodes[0].wait_for_rpc_connection()
if __name__ == '__main__':
TestBitcoinCli().main()