コード例 #1
0
ファイル: server_fuse_test.py プロジェクト: eliasmarkc/girder
    def testBlockedMount(self):
        """
        Test that when a mount point is non-empty the mount fails, is reported,
        and is not left in the list of mounts.
        """
        from girder.plugins.fuse import server_fuse

        blockFile = os.path.join(self.extraMountPath, 'block')
        open(blockFile, 'wb').close()
        mountpath = self.extraMountPath
        self.extraMount = 'test'
        with mock.patch(
                'girder.utility.plugin_utilities.logprint.error') as logprint:
            server_fuse.mountServerFuse(self.extraMount,
                                        mountpath,
                                        level=AccessType.READ,
                                        user=self.user)
            # If can take a short amount of time to trigger an error, so wait
            # for it.  Also wait for the mount information to be cleaned up.
            for iter in six.moves.range(50):
                if logprint.call_count and not server_fuse.isServerFuseMounted(
                        self.extraMount, level=AccessType.READ,
                        user=self.user):
                    break
                time.sleep(0.1)
            logprint.assert_called_once()
        self.assertFalse(
            server_fuse.isServerFuseMounted(self.extraMount,
                                            level=AccessType.READ,
                                            user=self.user))
        os.unlink(blockFile)
コード例 #2
0
ファイル: server_fuse_test.py プロジェクト: eliasmarkc/girder
    def testRemount(self):
        """
        Test remounting with different credentials.
        """
        from girder.plugins.fuse import server_fuse

        mountpath = self.extraMountPath
        self.extraMount = 'remount'
        # mount with user2
        self.assertTrue(
            server_fuse.mountServerFuse(self.extraMount,
                                        mountpath,
                                        level=AccessType.READ,
                                        user=self.user2))
        # The OS can cache stat, so wait 1 second before using the mount.
        time.sleep(1)
        publicFile = os.path.join(mountpath, self.publicFileName)
        privateFile = os.path.join(mountpath, self.privateFileName)
        self.assertTrue(os.path.exists(publicFile))
        self.assertFalse(os.path.exists(privateFile))
        # remount with user
        self.assertFalse(
            server_fuse.isServerFuseMounted(self.extraMount,
                                            level=AccessType.READ,
                                            user=self.user))
        self.assertTrue(
            server_fuse.mountServerFuse(self.extraMount,
                                        mountpath,
                                        level=AccessType.READ,
                                        user=self.user))
        # The OS can cache stat, so wait 1 second before using the mount.
        time.sleep(1)
        self.assertTrue(os.path.exists(publicFile))
        self.assertTrue(os.path.exists(privateFile))
コード例 #3
0
ファイル: server_fuse_test.py プロジェクト: satra/girder
    def testRemount(self):
        """
        Test remounting with different credentials.
        """
        from girder.plugins.fuse import server_fuse

        mountpath = self.extraMountPath
        self.extraMount = 'remount'
        # mount with user2
        self.assertTrue(server_fuse.mountServerFuse(
            self.extraMount, mountpath, level=AccessType.READ, user=self.user2))
        # The OS can cache stat, so wait 1 second before using the mount.
        time.sleep(1)
        publicFile = os.path.join(mountpath, self.publicFileName)
        privateFile = os.path.join(mountpath, self.privateFileName)
        self.assertTrue(os.path.exists(publicFile))
        self.assertFalse(os.path.exists(privateFile))
        # remount with user
        self.assertFalse(server_fuse.isServerFuseMounted(
            self.extraMount, level=AccessType.READ, user=self.user))
        self.assertTrue(server_fuse.mountServerFuse(
            self.extraMount, mountpath, level=AccessType.READ, user=self.user))
        # The OS can cache stat, so wait 1 second before using the mount.
        time.sleep(1)
        self.assertTrue(os.path.exists(publicFile))
        self.assertTrue(os.path.exists(privateFile))
コード例 #4
0
ファイル: server_fuse_test.py プロジェクト: satra/girder
    def testRemountWithoutChanges(self):
        """
        Test remounting with different credentials.
        """
        from girder.plugins.fuse import server_fuse

        mountpath = self.extraMountPath
        self.extraMount = 'remountWithoutChanges'
        # remount with user
        server_fuse.mountServerFuse(
            self.extraMount, mountpath, level=AccessType.READ, user=self.user)
        # remount without any changes should work
        self.assertTrue(server_fuse.isServerFuseMounted(
            self.extraMount, level=AccessType.READ, user=self.user))
        self.assertEqual(server_fuse.mountServerFuse(
            self.extraMount, mountpath, level=AccessType.READ, user=self.user),
            'present')
コード例 #5
0
ファイル: server_fuse_test.py プロジェクト: eliasmarkc/girder
    def testRemountWithoutChanges(self):
        """
        Test remounting with different credentials.
        """
        from girder.plugins.fuse import server_fuse

        mountpath = self.extraMountPath
        self.extraMount = 'remountWithoutChanges'
        # remount with user
        server_fuse.mountServerFuse(self.extraMount,
                                    mountpath,
                                    level=AccessType.READ,
                                    user=self.user)
        # remount without any changes should work
        self.assertTrue(
            server_fuse.isServerFuseMounted(self.extraMount,
                                            level=AccessType.READ,
                                            user=self.user))
        self.assertEqual(
            server_fuse.mountServerFuse(self.extraMount,
                                        mountpath,
                                        level=AccessType.READ,
                                        user=self.user), 'present')