Skip to content

Commit 727b67e

Browse files
committed
test: add coverage for bitcoin-cli -rpcwait
in interface_bitcoin_cli.py
1 parent 20c0e2e commit 727b67e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/functional/interface_bitcoin_cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def run_test(self):
7070
assert_equal(cli_get_info['proxy'], network_info['networks'][0]['proxy'])
7171
assert_equal(cli_get_info['difficulty'], blockchain_info['difficulty'])
7272
assert_equal(cli_get_info['chain'], blockchain_info['chain'])
73+
7374
if self.is_wallet_compiled():
7475
self.log.info("Test that -getinfo returns the expected wallet info")
7576
assert_equal(cli_get_info['balance'], BALANCE)
@@ -81,6 +82,17 @@ def run_test(self):
8182
else:
8283
self.log.info("*** Wallet not compiled; -getinfo wallet tests skipped")
8384

85+
self.stop_node(0)
86+
87+
self.log.info("Test -rpcwait option waits for RPC connection instead of failing")
88+
# Start node without RPC connection.
89+
self.nodes[0].start()
90+
# Verify failure without -rpcwait.
91+
assert_raises_process_error(1, "Could not connect to the server", self.nodes[0].cli('getblockcount').echo)
92+
# Verify success using -rpcwait.
93+
assert_equal(BLOCKS, self.nodes[0].cli('-rpcwait', 'getblockcount').send_cli())
94+
self.nodes[0].wait_for_rpc_connection()
95+
8496

8597
if __name__ == '__main__':
8698
TestBitcoinCli().main()

0 commit comments

Comments
 (0)