mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-28 18:01:27 +02:00
test: add coverage for bitcoin-cli -rpcwait
in interface_bitcoin_cli.py
This commit is contained in:
parent
20c0e2e0f0
commit
727b67e7b8
@ -70,6 +70,7 @@ class TestBitcoinCli(BitcoinTestFramework):
|
|||||||
assert_equal(cli_get_info['proxy'], network_info['networks'][0]['proxy'])
|
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['difficulty'], blockchain_info['difficulty'])
|
||||||
assert_equal(cli_get_info['chain'], blockchain_info['chain'])
|
assert_equal(cli_get_info['chain'], blockchain_info['chain'])
|
||||||
|
|
||||||
if self.is_wallet_compiled():
|
if self.is_wallet_compiled():
|
||||||
self.log.info("Test that -getinfo returns the expected wallet info")
|
self.log.info("Test that -getinfo returns the expected wallet info")
|
||||||
assert_equal(cli_get_info['balance'], BALANCE)
|
assert_equal(cli_get_info['balance'], BALANCE)
|
||||||
@ -81,6 +82,17 @@ class TestBitcoinCli(BitcoinTestFramework):
|
|||||||
else:
|
else:
|
||||||
self.log.info("*** Wallet not compiled; -getinfo wallet tests skipped")
|
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__':
|
if __name__ == '__main__':
|
||||||
TestBitcoinCli().main()
|
TestBitcoinCli().main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user