mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #14982: rpc: Add getrpcinfo command
a0ac15459adoc: Add getrpcinfo release notes (João Barbosa)251a91c1bfqa: Add tests for getrpcinfo (João Barbosa)d0730f5ce4rpc: Add getrpcinfo command (João Barbosa)068a8fc05frpc: Track active commands (João Barbosa)bf4383277drpc: Remove unused PreCommand signal (João Barbosa) Pull request description: The new `getrpcinfo` command exposes details of the RPC interface. The details can be configuration properties or runtime values/stats. This can be particular useful to coordinate concurrent functional tests (see #14958 from where this was extracted). Tree-SHA512: 7292cb6087f4c429973d991aa2b53ffa1327d5a213df7d6ba5fc69b01b2e1a411f6d1609fed9234896293317dab05f65064da48b8f2b4a998eba532591d31882
This commit is contained in:
@@ -5,13 +5,23 @@
|
||||
"""Tests some generic aspects of the RPC interface."""
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal
|
||||
from test_framework.util import assert_equal, assert_greater_than_or_equal
|
||||
|
||||
class RPCInterfaceTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
self.setup_clean_chain = True
|
||||
|
||||
def test_getrpcinfo(self):
|
||||
self.log.info("Testing getrpcinfo...")
|
||||
|
||||
info = self.nodes[0].getrpcinfo()
|
||||
assert_equal(len(info['active_commands']), 1)
|
||||
|
||||
command = info['active_commands'][0]
|
||||
assert_equal(command['method'], 'getrpcinfo')
|
||||
assert_greater_than_or_equal(command['duration'], 0)
|
||||
|
||||
def test_batch_request(self):
|
||||
self.log.info("Testing basic JSON-RPC batch request...")
|
||||
|
||||
@@ -39,6 +49,7 @@ class RPCInterfaceTest(BitcoinTestFramework):
|
||||
assert result_by_id[3]['result'] is not None
|
||||
|
||||
def run_test(self):
|
||||
self.test_getrpcinfo()
|
||||
self.test_batch_request()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user