]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Clean up queue loging and add a clock advance in unit test
authorDavid Stainton <dstainton415@gmail.com>
Wed, 27 Jan 2016 12:54:05 +0000 (12:54 +0000)
committerDavid Stainton <dstainton415@gmail.com>
Wed, 27 Jan 2016 12:54:05 +0000 (12:54 +0000)
not yet working

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

index 05bc4345fdc001af9f685b2cddf914d268b2c8b9..d8b29797cd05b8e0897e989cd0e465ddcdc3e733 100644 (file)
@@ -167,19 +167,20 @@ class QueueMixin(HookMixin):
                 self._count('objects_queued', -1)
             except IndexError:
                 self._log("deque is now empty")
+                self._lazy_tail.addBoth(self._logcb, "whawhat empty")
                 self._lazy_tail.addCallback(lambda ign: self._when_queue_is_empty())
+                self._lazy_tail.addBoth(self._logcb, "got past _when_queue_is_empty")
             else:
                 self._log("_turn_deque else clause")
-                def whawhat(result):
-                    self._log("whawhat result %r" % (result,))
-                    return result
-                self._lazy_tail.addBoth(whawhat)
+                self._lazy_tail.addBoth(self._logcb, "whawhat else %r" % (item,))
                 self._lazy_tail.addCallback(lambda ign: self._process(item))
+                self._lazy_tail.addBoth(self._logcb, "got past _process")
                 self._lazy_tail.addBoth(self._call_hook, 'processed')
-                self._lazy_tail.addErrback(log.err)
+                self._lazy_tail.addBoth(self._logcb, "got past _call_hook (turn_delay = %r)" % (self._turn_delay,))
                 self._lazy_tail.addCallback(lambda ign: task.deferLater(self._clock, self._turn_delay, self._turn_deque))
+                self._lazy_tail.addBoth(self._logcb, "got past deferLater")
         except Exception as e:
-            self._log("turn deque exception %s" % (e,))
+            self._log("---- turn deque exception %s" % (e,))
             raise
 
 
index 44bf25d17b8fd56da1e7dcf7d27a8263f4fc8714..4bfddbe0c67db1983b2c5d86e47c6fda01cf6f78 100644 (file)
@@ -1188,7 +1188,7 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase):
         # .tmp file shouldn't exist
         self.failIf(os.path.exists(local_file + u".tmp"))
 
-    def meowmeow_test_periodic_full_scan(self):
+    def test_periodic_full_scan(self):
         self.set_up_grid()
         self.local_dir = abspath_expanduser_unicode(u"test_periodic_full_scan",base=self.basedir)
         self.mkdir_nonascii(self.local_dir)
@@ -1235,9 +1235,15 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase):
             what_path = abspath_expanduser_unicode(u"what", base=new_empty_tree_dir)
             fileutil.write(what_path, "say when")
             print "ADVANCE CLOCK"
-            alice_clock.advance(self.magicfolder.uploader._periodic_full_scan_duration + 1)
+            #alice_clock.advance(self.magicfolder.uploader._periodic_full_scan_duration + 1)
             return uploaded_d
         d.addCallback(_create_file_without_event)
+        def _advance_clock(res):
+            print "_advance_clock"
+            alice_clock.advance(self.magicfolder.uploader._periodic_full_scan_duration + 1)
+        d.addCallback(_advance_clock)
+        d.addCallback(_advance_clock)
+        d.addCallback(_advance_clock)
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.files_uploaded'), 1))
         d.addCallback(lambda ign: self.magicfolder.finish())
         return d