mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-22 10:20:59 +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.addCallback(created)
|
||||||
d.addErrback(handle_config_error)
|
d.addErrback(handle_config_error)
|
||||||
d.addBoth(self._call_hook, 'running')
|
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
|
return d
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
@ -45,16 +45,16 @@ class Util(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertTrue(service is not None)
|
self.assertTrue(service is not None)
|
||||||
|
|
||||||
# @defer.inlineCallbacks
|
|
||||||
def test_daemonize_no_keygen(self):
|
def test_daemonize_no_keygen(self):
|
||||||
tmpdir = self.mktemp()
|
tmpdir = self.mktemp()
|
||||||
plug = DaemonizeTahoeNodePlugin('key-generator', tmpdir)
|
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):
|
def call(fn, *args, **kw):
|
||||||
fn()
|
d = fn()
|
||||||
# r.callWhenRunning = call
|
d.addErrback(lambda _: None) # ignore the error we'll trigger
|
||||||
# r.stop = 'foo'
|
r.callWhenRunning = call
|
||||||
|
r.stop = 'foo'
|
||||||
service = plug.makeService(None)
|
service = plug.makeService(None)
|
||||||
service.parent = Mock()
|
service.parent = Mock()
|
||||||
# we'll raise ValueError because there's no key-generator
|
# we'll raise ValueError because there's no key-generator
|
||||||
@ -65,10 +65,10 @@ class Util(unittest.TestCase):
|
|||||||
def done(f):
|
def done(f):
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"key-generator support removed",
|
"key-generator support removed",
|
||||||
str(str(f)),#ctx.exception)
|
str(f),
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
d.addErrback(done)
|
d.addBoth(done)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def test_daemonize_unknown_nodetype(self):
|
def test_daemonize_unknown_nodetype(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user