at least use random port

This commit is contained in:
meejah 2017-08-08 10:42:11 -06:00
parent e8699cd60d
commit e2a5751d02
1 changed files with 24 additions and 9 deletions

View File

@ -26,10 +26,14 @@ class TestNode(Node):
PORTNUMFILE='DEFAULT_PORTNUMFILE_BLANK'
class TestCase(testutil.SignalMixin, unittest.TestCase):
@defer.inlineCallbacks
def setUp(self):
testutil.SignalMixin.setUp(self)
self.parent = LoggingMultiService()
self.parent.startService()
self._available_port = yield iputil.allocate_tcp_port()
def tearDown(self):
log.msg("%s.tearDown" % self.__class__.__name__)
testutil.SignalMixin.tearDown(self)
@ -70,18 +74,29 @@ class TestCase(testutil.SignalMixin, unittest.TestCase):
def test_location_not_set(self):
"""Checks the autogenerated furl when tub.location is not set."""
return self._test_location(basedir="test_node/test_location3",
expected_addresses=["127.0.0.1:1234", "192.0.2.0:1234"],
tub_port=1234,
local_addresses=["127.0.0.1", "192.0.2.0"])
return self._test_location(
basedir="test_node/test_location3",
expected_addresses=[
"127.0.0.1:{}".format(self._available_port),
"192.0.2.0:{}".format(self._available_port),
],
tub_port=self._available_port,
local_addresses=["127.0.0.1", "192.0.2.0"],
)
def test_location_auto_and_explicit(self):
"""Checks the autogenerated furl when tub.location contains 'AUTO'."""
return self._test_location(basedir="test_node/test_location4",
expected_addresses=["127.0.0.1:1234", "192.0.2.0:1234", "example.com:4321"],
tub_port=1234,
tub_location="AUTO,example.com:4321",
local_addresses=["127.0.0.1", "192.0.2.0", "example.com:4321"])
return self._test_location(
basedir="test_node/test_location4",
expected_addresses=[
"127.0.0.1:{}".format(self._available_port),
"192.0.2.0:{}".format(self._available_port),
"example.com:4321",
],
tub_port=self._available_port,
tub_location="AUTO,example.com:{}".format(self._available_port),
local_addresses=["127.0.0.1", "192.0.2.0", "example.com:4321"],
)
def test_tahoe_cfg_utf8(self):
basedir = "test_node/test_tahoe_cfg_utf8"