Skip to content

Commit

Permalink
Fixed the drop uploader real tests
Browse files Browse the repository at this point in the history
  • Loading branch information
david415 committed Jun 3, 2015
1 parent 302977c commit fe797eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/allmydata/frontends/drop_upload.py
Expand Up @@ -90,10 +90,7 @@ def __init__(self, client, upload_dircap, local_dir, dbfile, inotify=None,
# possibly-incomplete file before the application has closed it. There should always
# be an IN_CLOSE_WRITE after an IN_CREATE (I think).
# TODO: what about IN_MOVE_SELF or IN_UNMOUNT?
#self.mask = inotify.IN_CLOSE_WRITE | inotify.IN_MOVED_TO | inotify.IN_ONLYDIR
#self.mask = inotify.IN_CLOSE_WRITE | inotify.IN_MOVED_TO | inotify.IN_MOVED_FROM | inotify.IN_ONLYDIR | IN_EXCL_UNLINK
self.mask = inotify.IN_CLOSE_WRITE | inotify.IN_MOVED_TO | inotify.IN_ONLYDIR | IN_EXCL_UNLINK | inotify.IN_DELETE
#self.mask = inotify.IN_CLOSE_WRITE | inotify.IN_MOVED_TO | inotify.IN_ONLYDIR | IN_EXCL_UNLINK
self._notifier.watch(self._local_path, mask=self.mask, callbacks=[self._notify],
recursive=True)

Expand Down Expand Up @@ -205,10 +202,7 @@ def _add_file(ignore, name):
return self._parent.add_file(name, u)

def _add_dir(ignore, name):
# XXX
#self._notifier.watch(to_filepath(path), mask=self.mask, callbacks=[self._notify], recursive=True)
print name
print self._local_dir
self._notifier.watch(to_filepath(path), mask=self.mask, callbacks=[self._notify], recursive=True)
d2 = self._parent.create_subdirectory(name, overwrite=False)
def _err(f):
f.trap(ExistingChildError)
Expand Down
4 changes: 2 additions & 2 deletions src/allmydata/test/test_drop_upload.py
Expand Up @@ -179,7 +179,7 @@ def _check_moved_tree_is_watched(res):
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.files_uploaded'), 2))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.directories_created'), 2))
"""

# Files that are moved out of the upload directory should no longer be watched.
def _move_dir_away(ign):
os.rename(new_empty_tree_dir, empty_tree_dir)
Expand All @@ -195,7 +195,7 @@ def create_file(val):
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.files_uploaded'), 2))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.directories_created'), 2))
"""

d.addBoth(self._cleanup)
return d

Expand Down

0 comments on commit fe797eb

Please sign in to comment.