mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-01 08:48:01 +00:00
please report all errors
This commit is contained in:
parent
1c68157c1f
commit
deb3109f43
@ -115,6 +115,7 @@ class DaemonizeTheRealService(Service, HookMixin):
|
|||||||
- 'running': triggered when startup has completed; it triggers
|
- 'running': triggered when startup has completed; it triggers
|
||||||
with None of successful or a Failure otherwise.
|
with None of successful or a Failure otherwise.
|
||||||
"""
|
"""
|
||||||
|
stderr = sys.stderr
|
||||||
|
|
||||||
def __init__(self, nodetype, basedir, options):
|
def __init__(self, nodetype, basedir, options):
|
||||||
super(DaemonizeTheRealService, self).__init__()
|
super(DaemonizeTheRealService, self).__init__()
|
||||||
@ -145,10 +146,12 @@ class DaemonizeTheRealService(Service, HookMixin):
|
|||||||
raise ValueError("unknown nodetype %s" % self.nodetype)
|
raise ValueError("unknown nodetype %s" % self.nodetype)
|
||||||
|
|
||||||
def handle_config_error(fail):
|
def handle_config_error(fail):
|
||||||
fail.trap(UnknownConfigError)
|
if fail.check(UnknownConfigError):
|
||||||
self.stderr.write("\nConfiguration error:\n{}\n\n".format(fail.value))
|
self.stderr.write("\nConfiguration error:\n{}\n\n".format(fail.value))
|
||||||
|
else:
|
||||||
|
self.stderr.write("\nUnknown error\n")
|
||||||
|
fail.printTraceback(self.stderr)
|
||||||
reactor.stop()
|
reactor.stop()
|
||||||
return
|
|
||||||
|
|
||||||
d = service_factory()
|
d = service_factory()
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
from io import (
|
||||||
|
BytesIO,
|
||||||
|
)
|
||||||
from os.path import dirname, join
|
from os.path import dirname, join
|
||||||
from mock import patch, Mock
|
from mock import patch, Mock
|
||||||
from six.moves import StringIO
|
from six.moves import StringIO
|
||||||
@ -52,6 +55,7 @@ class Util(unittest.TestCase):
|
|||||||
|
|
||||||
def test_daemonize_no_keygen(self):
|
def test_daemonize_no_keygen(self):
|
||||||
tmpdir = self.mktemp()
|
tmpdir = self.mktemp()
|
||||||
|
stderr = BytesIO()
|
||||||
plug = DaemonizeTahoeNodePlugin('key-generator', tmpdir)
|
plug = DaemonizeTahoeNodePlugin('key-generator', tmpdir)
|
||||||
|
|
||||||
with patch('twisted.internet.reactor') as r:
|
with patch('twisted.internet.reactor') as r:
|
||||||
@ -59,8 +63,8 @@ class Util(unittest.TestCase):
|
|||||||
d = fn()
|
d = fn()
|
||||||
d.addErrback(lambda _: None) # ignore the error we'll trigger
|
d.addErrback(lambda _: None) # ignore the error we'll trigger
|
||||||
r.callWhenRunning = call
|
r.callWhenRunning = call
|
||||||
r.stop = 'foo'
|
|
||||||
service = plug.makeService(self.options)
|
service = plug.makeService(self.options)
|
||||||
|
service.stderr = stderr
|
||||||
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
|
||||||
# .. BUT we do this in an async function called via
|
# .. BUT we do this in an async function called via
|
||||||
@ -70,7 +74,7 @@ class Util(unittest.TestCase):
|
|||||||
def done(f):
|
def done(f):
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"key-generator support removed",
|
"key-generator support removed",
|
||||||
str(f),
|
stderr.getvalue(),
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
d.addBoth(done)
|
d.addBoth(done)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user