[ARVADOS] updated: 45f37fe38bd3cb7ca1ff9a7c47791ec73888f383

git at public.curoverse.com git at public.curoverse.com
Fri Feb 5 19:41:10 EST 2016


Summary of changes:
 services/fuse/arvados_fuse/fusedir.py    |  4 ++++
 services/fuse/tests/test_command_args.py | 14 ++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

       via  45f37fe38bd3cb7ca1ff9a7c47791ec73888f383 (commit)
      from  8417bf754051966915b93c362624ebdcd492d660 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 45f37fe38bd3cb7ca1ff9a7c47791ec73888f383
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Feb 5 19:39:42 2016 -0500

    8285: Test that arvados.events.subscribe() is called only when needed.
    
    Add missing TagsDirectory.want_event_subscribe().

diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index f3f3c96..196bb22 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -641,6 +641,7 @@ will appear if it exists.
     def want_event_subscribe(self):
         return not self.pdh_only
 
+
 class RecursiveInvalidateDirectory(Directory):
     def invalidate(self):
         try:
@@ -661,6 +662,9 @@ class TagsDirectory(RecursiveInvalidateDirectory):
         self._poll = True
         self._poll_time = poll_time
 
+    def want_event_subscribe(self):
+        return True
+
     @use_counter
     def update(self):
         with llfuse.lock_released:
diff --git a/services/fuse/tests/test_command_args.py b/services/fuse/tests/test_command_args.py
index 70a1e59..bb80d0a 100644
--- a/services/fuse/tests/test_command_args.py
+++ b/services/fuse/tests/test_command_args.py
@@ -6,6 +6,7 @@ import functools
 import json
 import llfuse
 import logging
+import mock
 import os
 import run_test_server
 import sys
@@ -170,7 +171,8 @@ class MountArgsTest(unittest.TestCase):
         self.assertEqual(True, self.mnt.listen_for_events)
 
     @noexit
-    def test_custom(self):
+    @mock.patch('arvados.events.subscribe')
+    def test_custom(self, mock_subscribe):
         args = arvados_fuse.command.ArgumentParser().parse_args([
             '--mount-tmp', 'foo',
             '--mount-tmp', 'bar',
@@ -185,15 +187,23 @@ class MountArgsTest(unittest.TestCase):
         self.assertEqual(e.project_object['uuid'],
                          run_test_server.fixture('users')['active']['uuid'])
         self.assertEqual(True, self.mnt.listen_for_events)
+        with self.mnt:
+            pass
+        self.assertEqual(1, mock_subscribe.call_count)
 
     @noexit
-    def test_custom_no_listen(self):
+    @mock.patch('arvados.events.subscribe')
+    def test_custom_no_listen(self, mock_subscribe):
         args = arvados_fuse.command.ArgumentParser().parse_args([
+            '--mount-by-pdh', 'pdh',
             '--mount-tmp', 'foo',
             '--mount-tmp', 'bar',
             '--foreground', self.mntdir])
         self.mnt = arvados_fuse.command.Mount(args)
         self.assertEqual(False, self.mnt.listen_for_events)
+        with self.mnt:
+            pass
+        self.assertEqual(0, mock_subscribe.call_count)
 
     def test_custom_unsupported_layouts(self):
         for name in ['.', '..', '', 'foo/bar', '/foo']:

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list