aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpcbind_test.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-06-09 16:35:17 -0400
committerMarcoFalke <falke.marco@gmail.com>2017-10-03 18:43:15 +0200
commit4d3ba18386c7a09086d06c8b640c19343ff34188 (patch)
tree93de2e0a806af1d76f8b36faf1bf3f3a5677a684 /test/functional/rpcbind_test.py
parent11a5992c90d4cc9a3823ea08dab2c078bcbf15d2 (diff)
downloadbitcoin-4d3ba18386c7a09086d06c8b640c19343ff34188.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. Github-Pull: #11121 Rebased-From: 36b626867087e9fae6d85f926248997ebff327b7
Diffstat (limited to 'test/functional/rpcbind_test.py')
-rwxr-xr-xtest/functional/rpcbind_test.py13
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()