From: David Stainton Date: Fri, 11 Sep 2015 11:37:01 +0000 (+0200) Subject: Teach test_persistence to upload a 2nd file X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/somewhere?a=commitdiff_plain;h=1ef140005fcf19c4129d52efbbdb4b333eca2c10;p=tahoe-lafs%2Ftahoe-lafs.git Teach test_persistence to upload a 2nd file test fails... --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index b748d515..dedb29ef 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -203,7 +203,10 @@ class Uploader(QueueMixin): return d def start_scanning(self): + print "start_scanning self._db = %r" % (self._db,) self.is_ready = True + all_files = self._db.get_all_files() + print "ALL files recorded in magic-folder db: %s" % (all_files,) d = self._scan(self._local_path_u) # XXX do not want dropped deferreds! self._turn_deque() return d @@ -337,6 +340,7 @@ class Uploader(QueueMixin): return upload_d elif pathinfo.isfile: version = self._db.get_local_file_version(relpath_u) + print "LOCAL version %s" % (version,) if version is None: version = 0 else: diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index eb745ade..b291b3c0 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -203,18 +203,28 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual d = self.create_invite_join_magic_folder(u"Alice", self.local_dir) d.addCallback(self._create_magicfolder) - def create_test_file(result): + def create_test_file(result, filename): d2 = self.magicfolder.uploader.set_hook('processed') - test_file = abspath_expanduser_unicode(u"what", base=self.local_dir) + test_file = abspath_expanduser_unicode(filename, base=self.local_dir) fileutil.write(test_file, "meow") self.notify(to_filepath(test_file), self.inotify.IN_CLOSE_WRITE) return d2 - d.addCallback(create_test_file) + d.addCallback(lambda ign: create_test_file(ign, u"what1")) + def fu(ign): + print "upload complete" + d.addBoth(fu) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_succeeded'), 1)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_queued'), 0)) d.addCallback(self.cleanup) d.addCallback(self._restart_client) - d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_succeeded'), 0)) + + d.addCallback(lambda ign: create_test_file(ign, u"what2")) + + def fu2(ign): + print "2nd upload complete" + d.addBoth(fu2) + + d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_succeeded'), 1)) d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_queued'), 0)) d.addBoth(self.cleanup) return d