[tests] bind functional test nodes to 127.0.0.1
Prevents OSX firewall allow-this-application-to-accept-inbound-connections permission popups and is generally safer. To prevent binding to 127.0.0.1, set self.bind_to_localhost_only = False.
This commit is contained in:
parent
d3f4dd313e
commit
b156ff7c30
6 changed files with 21 additions and 6 deletions
test/functional/test_framework
|
@ -63,6 +63,7 @@ class BitcoinTestFramework():
|
|||
self.nodes = []
|
||||
self.mocktime = 0
|
||||
self.supports_cli = False
|
||||
self.bind_to_localhost_only = True
|
||||
self.set_test_params()
|
||||
|
||||
assert hasattr(self, "num_nodes"), "Test must set self.num_nodes in set_test_params()"
|
||||
|
@ -215,15 +216,19 @@ class BitcoinTestFramework():
|
|||
|
||||
def add_nodes(self, num_nodes, extra_args=None, rpchost=None, timewait=None, binary=None):
|
||||
"""Instantiate TestNode objects"""
|
||||
|
||||
if self.bind_to_localhost_only:
|
||||
extra_confs = [["bind=127.0.0.1"]] * num_nodes
|
||||
else:
|
||||
extra_confs = [[]] * num_nodes
|
||||
if extra_args is None:
|
||||
extra_args = [[]] * num_nodes
|
||||
if binary is None:
|
||||
binary = [None] * num_nodes
|
||||
assert_equal(len(extra_confs), num_nodes)
|
||||
assert_equal(len(extra_args), num_nodes)
|
||||
assert_equal(len(binary), num_nodes)
|
||||
for i in range(num_nodes):
|
||||
self.nodes.append(TestNode(i, self.options.tmpdir, extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, use_cli=self.options.usecli))
|
||||
self.nodes.append(TestNode(i, self.options.tmpdir, rpchost=rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
|
||||
|
||||
def start_node(self, i, *args, **kwargs):
|
||||
"""Start a bitcoind"""
|
||||
|
@ -395,7 +400,7 @@ class BitcoinTestFramework():
|
|||
args = [os.getenv("BITCOIND", "bitcoind"), "-datadir=" + datadir]
|
||||
if i > 0:
|
||||
args.append("-connect=127.0.0.1:" + str(p2p_port(0)))
|
||||
self.nodes.append(TestNode(i, self.options.cachedir, extra_args=[], rpchost=None, timewait=None, binary=None, stderr=None, mocktime=self.mocktime, coverage_dir=None))
|
||||
self.nodes.append(TestNode(i, self.options.cachedir, extra_conf=["bind=127.0.0.1"], extra_args=[],rpchost=None, timewait=None, binary=None, stderr=None, mocktime=self.mocktime, coverage_dir=None))
|
||||
self.nodes[i].args = args
|
||||
self.start_node(i)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue