]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Teach test_persistence to upload a 2nd file
authorDavid Stainton <dstainton415@gmail.com>
Fri, 11 Sep 2015 11:37:01 +0000 (13:37 +0200)
committerDaira Hopwood <daira@jacaranda.org>
Thu, 1 Oct 2015 00:19:48 +0000 (01:19 +0100)
test fails...

src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_magic_folder.py

index b748d5158a565c31986df9aaab079dc40d2fa735..dedb29eff68622032b306cdd0207a7b8c67ef499 100644 (file)
@@ -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:
index eb745ade28cf5f42edff3fd752fb53f59dcc4b7c..b291b3c0c24fb8585f7d29b8522ece62de3063cf 100644 (file)
@@ -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