Exemple #1
0
    def _clean():
        volatile = VolatileFactory.get_client()
        persistent = PersistentFactory.get_client()

        # noinspection PyProtectedMember
        volatile._clean()
        # noinspection PyProtectedMember
        persistent._clean()
        # noinspection PyProtectedMember
        SSHClient._clean()
        # noinspection PyProtectedMember
        SystemdMock._clean()
        # noinspection PyProtectedMember
        MDSClient._clean()
        # noinspection PyProtectedMember
        Decorators._clean()
        # noinspection PyProtectedMember
        MockedSSHClient._clean()
        # noinspection PyProtectedMember
        StorageRouterClient._clean()

        Logger._logs = {}
        DataList._test_hooks = {}
        Toolbox._function_pointers = {}
        # Clean underlying persistent store
        Configuration.get_client()._clean()

        for file_name in glob.glob(
                ArakoonClusterConfig.CONFIG_FILE.format('unittest*')):
            os.remove(file_name)

        for full_path in glob.glob(DalHelper.UNITTEST_DIR.format('*')):
            shutil.rmtree(full_path)

        return volatile, persistent
Exemple #2
0
    def test_rename_unhappy(self):
        """
        Test made to prevent wrongly joined paths when an '_' occurred at the end of a key
        """
        rename_key_old = 'test_folder'
        rename_key_new = 'test_folder_changed'
        set_data = [(basestring, '{0}_'.format(rename_key_old), rename_key_old, False), (basestring, '{0}_/test_file'.format(rename_key_old), rename_key_old, False)]
        get_data = [(basestring, '/{0}_'.format(rename_key_old), rename_key_old, False), (basestring, '/{0}_/test_file'.format(rename_key_old), rename_key_old, False)]
        self._assert_set_get(set_data, get_data)
        Configuration.rename(rename_key_old, rename_key_new)

        c = Configuration.get_client()
        entries = c.prefix_entries(rename_key_old)
        self.assertTrue(Configuration.get('{0}_'.format(rename_key_old)) == rename_key_old)  # None of these keys should be renamed
        self.assertTrue(Configuration.get('{0}_/test_file'.format(rename_key_old)) == rename_key_old)
        self.assertFalse(any(['/../' in i[0] for i in entries]), 'Error during joining of prefixes')  # Check if joining error happened in some key
Exemple #3
0
 def test_jeff(self):
     Configuration.set('djef/test', 'test_content')
     Configuration.set('djef_test1', 'test_content')
     Configuration.rename('djef', 'djef2')
     c = Configuration.get_client()
     self.assertListEqual(c.prefix_entries('djef'), [('djef_test1', '"test_content"'), ('djef2/test', '"test_content"')])