MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / run_bind_test

Method run_bind_test

test/functional/rpc_bind.py:29–45  ·  view source on GitHub ↗

Start a node with requested rpcallowip and rpcbind parameters, then try to connect, and check if the set of bound addresses matches the expected set.

(self, allow_ips, connect_to, addresses, expected)

Source from the content-addressed store, hash-verified

27 parser.add_argument("--nonloopback", action='store_true', dest="run_nonloopback", help="Run non-loopback tests only", default=False)
28
29 def run_bind_test(self, allow_ips, connect_to, addresses, expected):
30 '''
31 Start a node with requested rpcallowip and rpcbind parameters,
32 then try to connect, and check if the set of bound addresses
33 matches the expected set.
34 '''
35 self.log.info("Bind test for %s" % str(addresses))
36 expected = [(addr_to_hex(addr), port) for (addr, port) in expected]
37 base_args = ['-disablewallet', '-nolisten']
38 if allow_ips:
39 base_args += ['-rpcallowip=' + x for x in allow_ips]
40 binds = ['-rpcbind='+addr for addr in addresses]
41 self.nodes[0].rpchost = connect_to
42 self.start_node(0, base_args + binds)
43 pid = self.nodes[0].process.pid
44 assert_equal(set(get_bind_addrs(pid)), set(expected))
45 self.stop_nodes()
46
47 def run_invalid_bind_test(self, allow_ips, addresses):
48 '''

Callers 2

_run_loopback_testsMethod · 0.95

Calls 6

addr_to_hexFunction · 0.90
assert_equalFunction · 0.90
get_bind_addrsFunction · 0.90
infoMethod · 0.80
start_nodeMethod · 0.80
stop_nodesMethod · 0.80

Tested by

no test coverage detected