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)
| 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 | ''' |
no test coverage detected