diff options
author | John Newbery <john@johnnewbery.com> | 2017-06-09 16:35:17 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2017-09-01 12:25:54 -0400 |
commit | 36b626867087e9fae6d85f926248997ebff327b7 (patch) | |
tree | ecf522bb82c52e8c9c58bcd7839d550e71684ca4 /test/functional/rpcbind_test.py | |
parent | be2a2ab6a67beef97e3c3cf42bd5eeea6c4e55cf (diff) | |
download | bitcoin-36b626867087e9fae6d85f926248997ebff327b7.tar.xz |
[tests] TestNode: separate add_node from start_node
Separates the act of creating a TestNode object from starting the node.
The test_framework now keeps track of its list of TestNodes, and test
writers can call start_node() and stop_node() without having to update
the self.nodes list.
Diffstat (limited to 'test/functional/rpcbind_test.py')
-rwxr-xr-x | test/functional/rpcbind_test.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/functional/rpcbind_test.py b/test/functional/rpcbind_test.py index 20808207b2..e9d64af204 100755 --- a/test/functional/rpcbind_test.py +++ b/test/functional/rpcbind_test.py @@ -20,10 +20,7 @@ class RPCBindTest(BitcoinTestFramework): self.num_nodes = 1 def setup_network(self): - pass - - def setup_nodes(self): - pass + self.add_nodes(self.num_nodes, self.options.tmpdir, None) def run_bind_test(self, allow_ips, connect_to, addresses, expected): ''' @@ -31,12 +28,14 @@ class RPCBindTest(BitcoinTestFramework): then try to connect, and check if the set of bound addresses matches the expected set. ''' + self.log.info("Bind test for %s" % str(addresses)) expected = [(addr_to_hex(addr), port) for (addr, port) in expected] base_args = ['-disablewallet', '-nolisten'] if allow_ips: base_args += ['-rpcallowip=' + x for x in allow_ips] binds = ['-rpcbind='+addr for addr in addresses] - self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, [base_args + binds], connect_to) + self.nodes[0].rpchost = connect_to + self.start_node(0, base_args + binds) pid = self.nodes[0].process.pid assert_equal(set(get_bind_addrs(pid)), set(expected)) self.stop_nodes() @@ -46,8 +45,10 @@ class RPCBindTest(BitcoinTestFramework): Start a node with rpcallow IP, and request getnetworkinfo at a non-localhost IP. ''' + self.log.info("Allow IP test for %s:%d" % (rpchost, rpcport)) base_args = ['-disablewallet', '-nolisten'] + ['-rpcallowip='+x for x in allow_ips] - self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, [base_args]) + self.nodes[0].rpchost = None + self.start_nodes([base_args]) # connect to node through non-loopback interface node = get_rpc_proxy(rpc_url(get_datadir_path(self.options.tmpdir, 0), 0, "%s:%d" % (rpchost, rpcport)), 0, coveragedir=self.options.coveragedir) node.getnetworkinfo() |