mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 02:01:31 +00:00
proper daemonize error-handling
This commit is contained in:
parent
08e0c3b7e2
commit
5d6a76ffee
@ -154,9 +154,6 @@ class DaemonizeTheRealService(Service, HookMixin):
|
||||
d.addCallback(created)
|
||||
d.addErrback(handle_config_error)
|
||||
d.addBoth(self._call_hook, 'running')
|
||||
# we've handled error via hook now (otherwise Twisted will
|
||||
# want to fail some things)
|
||||
d.addErrback(lambda _: None)
|
||||
return d
|
||||
|
||||
from twisted.internet import reactor
|
||||
|
@ -45,16 +45,16 @@ class Util(unittest.TestCase):
|
||||
|
||||
self.assertTrue(service is not None)
|
||||
|
||||
# @defer.inlineCallbacks
|
||||
def test_daemonize_no_keygen(self):
|
||||
tmpdir = self.mktemp()
|
||||
plug = DaemonizeTahoeNodePlugin('key-generator', tmpdir)
|
||||
|
||||
if True:#with patch('twisted.internet.reactor') as r:
|
||||
with patch('twisted.internet.reactor') as r:
|
||||
def call(fn, *args, **kw):
|
||||
fn()
|
||||
# r.callWhenRunning = call
|
||||
# r.stop = 'foo'
|
||||
d = fn()
|
||||
d.addErrback(lambda _: None) # ignore the error we'll trigger
|
||||
r.callWhenRunning = call
|
||||
r.stop = 'foo'
|
||||
service = plug.makeService(None)
|
||||
service.parent = Mock()
|
||||
# we'll raise ValueError because there's no key-generator
|
||||
@ -65,10 +65,10 @@ class Util(unittest.TestCase):
|
||||
def done(f):
|
||||
self.assertIn(
|
||||
"key-generator support removed",
|
||||
str(str(f)),#ctx.exception)
|
||||
str(f),
|
||||
)
|
||||
return None
|
||||
d.addErrback(done)
|
||||
d.addBoth(done)
|
||||
return d
|
||||
|
||||
def test_daemonize_unknown_nodetype(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user