all tests pass. wooo

This commit is contained in:
meejah 2018-01-28 21:49:05 -07:00
parent c7515b5d8b
commit 0ff21ea7d5
4 changed files with 32 additions and 32 deletions

View File

@ -2,8 +2,11 @@
# This is for compatibilty with old .tac files, which reference # This is for compatibilty with old .tac files, which reference
# allmydata.introducer.IntroducerNode # allmydata.introducer.IntroducerNode
from allmydata.introducer.server import create_introducer
# apparently need to support "old .tac files" that may have this name burned in
# don't use this in new code
from allmydata.introducer.server import _IntroducerNode as IntroducerNode from allmydata.introducer.server import _IntroducerNode as IntroducerNode
# hush pyflakes # hush pyflakes
_unused = [IntroducerNode] _unused = [create_introducer, IntroducerNode]
del _unused del _unused

View File

@ -65,17 +65,16 @@ def create_introducer(basedir=u"."):
control_tub = create_control_tub() control_tub = create_control_tub()
return defer.succeed( node = _IntroducerNode(
_IntroducerNode( config,
config, main_tub,
main_tub, control_tub,
control_tub, i2p_provider,
i2p_provider, tor_provider,
tor_provider, basedir,
basedir, tub_is_listening=is_listening,
tub_is_listening=is_listening,
)
) )
return defer.succeed(node)
class _IntroducerNode(node.Node): class _IntroducerNode(node.Node):

View File

@ -557,18 +557,14 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
f = open(os.path.join(iv_dir, "private", "node.pem"), "w") f = open(os.path.join(iv_dir, "private", "node.pem"), "w")
f.write(SYSTEM_TEST_CERTS[0]) f.write(SYSTEM_TEST_CERTS[0])
f.close() f.close()
return create_introducer(basedir=iv_dir) iv = yield create_introducer(basedir=iv_dir)
# ======= self.introducer = self.add_service(iv)
# iv = yield create_introducer(basedir=iv_dir) self._get_introducer_web()
# print("introducer {}".format(iv)) if use_stats_gatherer:
# self.introducer = self.add_service(iv) yield self._set_up_stats_gatherer(None)
# self._get_introducer_web() yield self._set_up_nodes_2(None)
# if use_stats_gatherer: if use_stats_gatherer:
# yield self._set_up_stats_gatherer(None) yield self._grab_stats(None)
# yield self._set_up_nodes_2(None)
# if use_stats_gatherer:
# yield self._grab_stats(None)
# >>>>>>> more working test
def _get_introducer_web(self): def _get_introducer_web(self):
with open(os.path.join(self.getdir("introducer"), "node.url"), "r") as f: with open(os.path.join(self.getdir("introducer"), "node.url"), "r") as f:
@ -749,8 +745,10 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
# behavior, see if this is really the problem, see if we can do # behavior, see if this is really the problem, see if we can do
# better than blindly waiting for a second. # better than blindly waiting for a second.
d.addCallback(self.stall, 1.0) d.addCallback(self.stall, 1.0)
@defer.inlineCallbacks
def _stopped(res): def _stopped(res):
new_c = client.create_client(self.getdir("client%d" % num)) new_c = yield client.create_client(self.getdir("client%d" % num))
self.clients[num] = new_c self.clients[num] = new_c
new_c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE) new_c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
self.add_service(new_c) self.add_service(new_c)
@ -763,6 +761,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
d.addCallback(_maybe_get_webport) d.addCallback(_maybe_get_webport)
return d return d
@defer.inlineCallbacks
def add_extra_node(self, client_num, helper_furl=None, def add_extra_node(self, client_num, helper_furl=None,
add_to_sparent=False): add_to_sparent=False):
# usually this node is *not* parented to our self.sparent, so we can # usually this node is *not* parented to our self.sparent, so we can
@ -777,7 +776,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
config += "helper.furl = %s\n" % helper_furl config += "helper.furl = %s\n" % helper_furl
fileutil.write(os.path.join(basedir, 'tahoe.cfg'), config) fileutil.write(os.path.join(basedir, 'tahoe.cfg'), config)
c = client.create_client(basedir) c = yield client.create_client(basedir)
self.clients.append(c) self.clients.append(c)
c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE) c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
self.numclients += 1 self.numclients += 1
@ -785,9 +784,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
c.setServiceParent(self.sparent) c.setServiceParent(self.sparent)
else: else:
c.startService() c.startService()
d = self.wait_for_connections() res = yield self.wait_for_connections()
d.addCallback(lambda res: c) defer.returnValue(c)
return d
def _check_connections(self): def _check_connections(self):
for i, c in enumerate(self.clients): for i, c in enumerate(self.clients):

View File

@ -1,7 +1,9 @@
from os.path import join
from twisted.trial import unittest from twisted.trial import unittest
from foolscap.api import fireEventually, flushEventualQueue from foolscap.api import fireEventually, flushEventualQueue
from twisted.internet import defer from twisted.internet import defer
from allmydata.introducer import IntroducerNode from allmydata.introducer import create_introducer
from allmydata.util import fileutil
from allmydata import node from allmydata import node
from .common import FAVICON_MARKUP from .common import FAVICON_MARKUP
from ..common_web import do_http from ..common_web import do_http
@ -28,9 +30,7 @@ class IntroducerWeb(unittest.TestCase):
node.create_node_dir(basedir, "testing") node.create_node_dir(basedir, "testing")
from allmydata.node import config_from_string from allmydata.node import config_from_string
self.node = IntroducerNode( self.node = yield create_introducer(basedir)
config_from_string(config, "introducer.port", basedir),
)
self.ws = self.node.getServiceNamed("webish") self.ws = self.node.getServiceNamed("webish")
yield fireEventually(None) yield fireEventually(None)