MCPcopy Create free account
hub / github.com/ElementsProject/elements / run_bind_test

Method run_bind_test

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

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

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.45
stop_nodesMethod · 0.45

Tested by

no test coverage detected