]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
introducer: don't log.err() an initial connection failure, since that flunks tests...
authorBrian Warner <warner@allmydata.com>
Thu, 9 Aug 2007 19:53:44 +0000 (12:53 -0700)
committerBrian Warner <warner@allmydata.com>
Thu, 9 Aug 2007 19:53:44 +0000 (12:53 -0700)
src/allmydata/introducer.py
src/allmydata/test/test_client.py

index c7618867d6bed5aa602795dc3e627a26b87c3f23..4d2f088f12068287d07992943758b7190509e2d4 100644 (file)
@@ -59,8 +59,9 @@ class IntroducerClient(service.Service, Referenceable):
         self.introducer_reconnector = self.tub.connectTo(self.introducer_furl,
                                                          self._got_introducer)
         def connect_failed(failure):
-            self.log("\n\nInitial Introducer connection failed: perhaps it's down\n")
-            log.err(failure)
+            self.log("\n\nInitial Introducer connection failed: "
+                     "perhaps it's down\n")
+            self.log(str(failure))
         d = self.tub.getReference(self.introducer_furl)
         d.addErrback(connect_failed)
 
index f55980ec178fad1297e1e1fcf61540f519002236..016be9bdecbe222572bedb8069d173de0b3dc031 100644 (file)
@@ -2,6 +2,7 @@
 import os
 from twisted.trial import unittest
 from twisted.application import service
+from twisted.internet import reactor, defer
 
 import allmydata
 from allmydata import client, introducer
@@ -133,6 +134,11 @@ class Run(unittest.TestCase):
         open(os.path.join(basedir, "suicide_prevention_hotline"), "w")
         c = client.Client(basedir)
 
+    def stall(self, res=None, delay=1):
+        d = defer.Deferred()
+        reactor.callLater(delay, d.callback, res)
+        return d
+
     def test_reloadable(self):
         basedir = "test_client.Run.test_reloadable"
         os.mkdir(basedir)
@@ -141,7 +147,8 @@ class Run(unittest.TestCase):
         c1 = client.Client(basedir)
         c1.setServiceParent(self.sparent)
 
-        d = c1.disownServiceParent()
+        d = self.stall(delay=0.1)
+        d.addCallback(lambda res: c1.disownServiceParent())
         def _restart(res):
             c2 = client.Client(basedir)
             c2.setServiceParent(self.sparent)