Add Eliot logging for cleanup action

This commit is contained in:
Jean-Paul Calderone 2019-03-08 11:41:31 -05:00
parent eba642a9a1
commit a8d67a09a5

View File

@ -6,6 +6,10 @@ import re
import time import time
from datetime import datetime from datetime import datetime
from eliot.twisted import (
DeferredContext,
)
from twisted.trial import unittest from twisted.trial import unittest
from twisted.internet import defer from twisted.internet import defer
from twisted.internet import reactor from twisted.internet import reactor
@ -23,7 +27,9 @@ from allmydata.util.fileutil import abspath_expanduser_unicode
from allmydata.util.encodingutil import unicode_to_argv from allmydata.util.encodingutil import unicode_to_argv
from allmydata.frontends.magic_folder import MagicFolder from allmydata.frontends.magic_folder import MagicFolder
from allmydata import uri from allmydata import uri
from ...util.eliotutil import (
log_call_deferred,
)
class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin, NonASCIIPathMixin): class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin, NonASCIIPathMixin):
def setUp(self): def setUp(self):
@ -146,14 +152,15 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin, NonASCIIPathMixin):
return d return d
# XXX should probably just be "tearDown"... # XXX should probably just be "tearDown"...
@log_call_deferred(action_type=u"test:cli:magic-folder:cleanup")
def cleanup(self, res): def cleanup(self, res):
d = defer.succeed(None) d = DeferredContext(defer.succeed(None))
def _clean(ign): def _clean(ign):
return self.magicfolder.disownServiceParent() return self.magicfolder.disownServiceParent()
d.addCallback(_clean) d.addCallback(_clean)
d.addCallback(lambda ign: res) d.addCallback(lambda ign: res)
return d return d.result
def init_magicfolder(self, client_num, upload_dircap, collective_dircap, local_magic_dir, clock): def init_magicfolder(self, client_num, upload_dircap, collective_dircap, local_magic_dir, clock):
dbfile = abspath_expanduser_unicode(u"magicfolder_default.sqlite", base=self.get_clientdir(i=client_num)) dbfile = abspath_expanduser_unicode(u"magicfolder_default.sqlite", base=self.get_clientdir(i=client_num))