[ARVADOS] updated: 1ce079f002566b28c450959b1d7389c8c85ab6f0

git at public.curoverse.com git at public.curoverse.com
Wed Feb 19 15:28:22 EST 2014


Summary of changes:
 sdk/python/test_mount.py |   55 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

       via  1ce079f002566b28c450959b1d7389c8c85ab6f0 (commit)
      from  2b1a709c1e3ff70d811804bfd9fa58a7231bd5cb (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 1ce079f002566b28c450959b1d7389c8c85ab6f0
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed Feb 19 15:29:30 2014 -0500

    Added test for magic directories.

diff --git a/sdk/python/test_mount.py b/sdk/python/test_mount.py
index c361de2..ce61598 100644
--- a/sdk/python/test_mount.py
+++ b/sdk/python/test_mount.py
@@ -96,3 +96,58 @@ class FuseMountTest(unittest.TestCase):
 
         os.rmdir(self.mounttmp)
         shutil.rmtree(self.keeptmp)
+
+class FuseMagicTest(unittest.TestCase):
+    def setUp(self):
+        self.keeptmp = tempfile.mkdtemp()
+        os.environ['KEEP_LOCAL_STORE'] = self.keeptmp
+
+        cw = arvados.CollectionWriter()
+
+        cw.start_new_file('thing1.txt')
+        cw.write("data 1")
+
+        self.testcollection = cw.finish()
+
+    def runTest(self):
+        # Create the request handler
+        operations = fuse.Operations(os.getuid(), os.getgid())
+        e = operations.inodes.add_entry(fuse.MagicDirectory(llfuse.ROOT_INODE, operations.inodes))
+
+        self.mounttmp = tempfile.mkdtemp()
+
+        llfuse.init(operations, self.mounttmp, [])
+        t = threading.Thread(None, lambda: llfuse.main())
+        t.start()
+
+        # wait until the driver is finished initializing
+        operations.initlock.wait()
+
+        # now check some stuff
+        d1 = os.listdir(self.mounttmp)
+        d1.sort()
+        self.assertEqual(d1, [])
+
+        d2 = os.listdir(os.path.join(self.mounttmp, self.testcollection))
+        d2.sort()
+        self.assertEqual(d2, ['thing1.txt'])
+
+        d3 = os.listdir(self.mounttmp)
+        d3.sort()
+        self.assertEqual(d3, [self.testcollection])
+        
+        files = {}
+        files[os.path.join(self.mounttmp, self.testcollection, 'thing1.txt')] = 'data 1'
+
+        for k, v in files.items():
+            with open(os.path.join(self.mounttmp, k)) as f:
+                self.assertEqual(f.read(), v)
+        
+
+    def tearDown(self):
+        # llfuse.close is buggy, so use fusermount instead.
+        #llfuse.close(unmount=True)
+        subprocess.call(["fusermount", "-u", self.mounttmp])
+
+        os.rmdir(self.mounttmp)
+        shutil.rmtree(self.keeptmp)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list