Skip to content

Commit caea5f0

Browse files
l0rincjonatack
andcommitted
test: add coverage for -netinfo header and local services
Co-authored-by: Jon Atack <jon@atack.com>
1 parent 6705628 commit caea5f0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/functional/interface_bitcoin_cli.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ def set_test_params(self):
8383
def skip_test_if_missing_module(self):
8484
self.skip_if_no_cli()
8585

86+
def test_netinfo(self):
87+
"""Test -netinfo output format."""
88+
self.log.info("Test -netinfo header and separate local services line")
89+
out = self.nodes[0].cli('-netinfo').send_cli().splitlines()
90+
assert out[0].startswith(f"{self.config['environment']['CLIENT_NAME']} client ")
91+
assert any(re.match(r"^Local services:.+network", line) for line in out)
92+
93+
self.log.info("Test -netinfo local services are moved to header if details are requested")
94+
det = self.nodes[0].cli('-netinfo', '1').send_cli().splitlines()
95+
self.log.debug(f"Test -netinfo 1 header output: {det[0]}")
96+
assert re.match(rf"^{re.escape(self.config['environment']['CLIENT_NAME'])} client.+services nwl2?$", det[0])
97+
assert not any(line.startswith("Local services:") for line in det)
98+
8699
def run_test(self):
87100
"""Main test logic"""
88101
self.generate(self.nodes[0], BLOCKS)
@@ -379,6 +392,8 @@ def run_test(self):
379392
self.log.info("*** Wallet not compiled; cli getwalletinfo and -getinfo wallet tests skipped")
380393
self.generate(self.nodes[0], 25) # maintain block parity with the wallet_compiled conditional branch
381394

395+
self.test_netinfo()
396+
382397
self.log.info("Test -version with node stopped")
383398
self.stop_node(0)
384399
cli_response = self.nodes[0].cli('-version').send_cli()

0 commit comments

Comments
 (0)