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

Method run_bind_test

test/functional/rpc_bind.py:27–43  ·  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

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

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