Skip to content

Commit

Permalink
test: add coverage for bitcoin-cli -rpcwait
Browse files Browse the repository at this point in the history
in interface_bitcoin_cli.py
  • Loading branch information
jonatack committed Apr 15, 2020
1 parent 20c0e2e commit 727b67e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/functional/interface_bitcoin_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def run_test(self):
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)
Expand All @@ -81,6 +82,17 @@ def run_test(self):
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()

0 comments on commit 727b67e

Please sign in to comment.