X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f1603177aa4cf91a91528f8705b33fc3e5bef2fa..52141835e85e4014a691e036f89bcd71a98bd6b2:/services/fuse/tests/test_mount.py?ds=sidebyside diff --git a/services/fuse/tests/test_mount.py b/services/fuse/tests/test_mount.py index b188796ac4..3db5281eb0 100644 --- a/services/fuse/tests/test_mount.py +++ b/services/fuse/tests/test_mount.py @@ -73,7 +73,7 @@ class FuseMountTest(MountTestBase): def runTest(self): # Create the request handler operations = fuse.Operations(os.getuid(), os.getgid()) - e = operations.inodes.add_entry(fuse.CollectionDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, self.testcollection)) + e = operations.inodes.add_entry(fuse.CollectionDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0, self.testcollection)) llfuse.init(operations, self.mounttmp, []) t = threading.Thread(None, lambda: llfuse.main()) @@ -128,7 +128,7 @@ class FuseMagicTest(MountTestBase): 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.api)) + e = operations.inodes.add_entry(fuse.MagicDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0)) self.mounttmp = tempfile.mkdtemp() @@ -163,7 +163,7 @@ class FuseMagicTest(MountTestBase): class FuseTagsTest(MountTestBase): def runTest(self): operations = fuse.Operations(os.getuid(), os.getgid()) - e = operations.inodes.add_entry(fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, self.api)) + e = operations.inodes.add_entry(fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0)) llfuse.init(operations, self.mounttmp, []) t = threading.Thread(None, lambda: llfuse.main()) @@ -188,7 +188,7 @@ class FuseTagsTest(MountTestBase): class FuseTagsUpdateTest(MountTestBase): def runRealTest(self): operations = fuse.Operations(os.getuid(), os.getgid()) - e = operations.inodes.add_entry(fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, poll_time=1)) + e = operations.inodes.add_entry(fuse.TagsDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0, poll_time=1)) llfuse.init(operations, self.mounttmp, []) t = threading.Thread(None, lambda: llfuse.main()) @@ -241,7 +241,7 @@ class FuseTagsUpdateTest(MountTestBase): class FuseSharedTest(MountTestBase): def runTest(self): operations = fuse.Operations(os.getuid(), os.getgid()) - e = operations.inodes.add_entry(fuse.SharedDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, self.api.users().current().execute()['uuid'])) + e = operations.inodes.add_entry(fuse.SharedDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0, self.api.users().current().execute()['uuid'])) llfuse.init(operations, self.mounttmp, []) t = threading.Thread(None, lambda: llfuse.main()) @@ -250,39 +250,42 @@ class FuseSharedTest(MountTestBase): # wait until the driver is finished initializing operations.initlock.wait() - d1 = os.listdir(self.mounttmp) - d1.sort() - self.assertIn('Active User', d1) - - d2 = os.listdir(os.path.join(self.mounttmp, 'Active User')) - d2.sort() - self.assertEqual(['A Project', - "Empty collection", - "Empty collection.link", - "Pipeline Template with Input Parameter with Search.pipelineTemplate", - "Pipeline Template with Jobspec Components.pipelineTemplate", - "collection_expires_in_future", - "pipeline_with_job.pipelineInstance", - "pipeline_with_template.pipelineInstance" - ], d2) - - d3 = os.listdir(os.path.join(self.mounttmp, 'Active User', 'A Project')) - d3.sort() - self.assertEqual(["A Subproject", - "Two Part Pipeline Template.pipelineTemplate", - "collection_to_move_around", - "zzzzz-4zz18-fy296fx3hot09f7 added sometime" - ], d3) - - with open(os.path.join(self.mounttmp, 'Active User', "A Project", "Two Part Pipeline Template.pipelineTemplate")) as f: + # shared_dirs is a list of the directories exposed + # by fuse.SharedDirectory (i.e. any object visible + # to the current user) + shared_dirs = os.listdir(self.mounttmp) + shared_dirs.sort() + self.assertIn('FUSE User', shared_dirs) + + # fuse_user_dirs is a list of the directories owned + # by the "FUSE User" test user. + fuse_user_dirs = os.listdir(os.path.join(self.mounttmp, 'FUSE User')) + fuse_user_dirs.sort() + self.assertEqual(['FUSE Test Project', + 'collection #1 owned by FUSE', + 'collection #2 owned by FUSE' + ], fuse_user_dirs) + + # test_proj_files is a list of the files in the FUSE Test Project. + test_proj_files = os.listdir(os.path.join(self.mounttmp, 'FUSE User', 'FUSE Test Project')) + test_proj_files.sort() + self.assertEqual(['Pipeline Template in FUSE Project.pipelineTemplate', + 'collection in FUSE project', + ], test_proj_files) + + with open(os.path.join( + self.mounttmp, + 'FUSE User', + 'FUSE Test Project', + 'Pipeline Template in FUSE Project.pipelineTemplate')) as f: j = json.load(f) - self.assertEqual("Two Part Pipeline Template", j['name']) + self.assertEqual("Pipeline Template in FUSE Project", j['name']) class FuseHomeTest(MountTestBase): def runTest(self): operations = fuse.Operations(os.getuid(), os.getgid()) - e = operations.inodes.add_entry(fuse.ProjectDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, self.api.users().current().execute())) + e = operations.inodes.add_entry(fuse.ProjectDirectory(llfuse.ROOT_INODE, operations.inodes, self.api, 0, self.api.users().current().execute())) llfuse.init(operations, self.mounttmp, []) t = threading.Thread(None, lambda: llfuse.main())