예제 #1
0
    def error_test_deep_nested_dataset_dict_add(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info(
            "description : Error testing path error for CMD_DICT_ADD for deep nested dataset "
            "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys, levels = data_set.load()
        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_add_dict(inserted_keys,
                            add_str='child',
                            path=self._get_path('child', levels - 2),
                            error="Memcached error #197 'Cant insert'",
                            field='Testing empty path for dictionary',
                            result=result)
        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_add_dict(inserted_keys,
                            add_str="new_value",
                            path=self._get_path('child', levels - 2),
                            error="Memcached error #197 'Cant insert'",
                            field='path does not exist',
                            result=result)
        self.assertTrue(len(result) > 0, result)
        ''' Change error behaviour , there is something wrong on the call '''
예제 #2
0
    def error_test_deep_nested_dataset_dict_upsert(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info(
            "description : Error testing path error for CMD_DICT_UPSERT for deep nested dataset "
            "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys, levels = data_set.load()
        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_upsert_dict(inserted_keys,
                               add_str='child',
                               path=self._get_path('child', levels - 2),
                               error="Memcached error #197 'Cant insert'",
                               field='path does not exist',
                               result=result)
        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_upsert_dict(inserted_keys,
                               add_str="new_value",
                               path=self._get_path('child', levels - 2),
                               error="Memcached error #197 'Cant insert'",
                               field='path does not exist',
                               result=result)
        '''document does not exist'''
        self.log.info('Document does not exist')
        self.error_upsert_dict(['key_does_not_exist'],
                               add_str="new_value",
                               path="does_not_matter",
                               error="Memcached error #197 'Cant insert'",
                               field='Document does not exist',
                               result=result)
        self.assertTrue(len(result) == 0, result)
예제 #3
0
    def error_test_deep_nested_dataset_exists(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info("description : Error testing path error for CMD_EXISTS for deep nested dataset "
                      "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys, levels = data_set.load()

        '''path does not exist'''
        self.log.info('Testing last+1 element dictionary')
        self.error_exists(inserted_keys, path = self._get_path('child', levels+1), error="Memcached error #192 'Path not exists'", field = 'path does not exist', result  = result)

        '''Invalid path'''
        self.log.info('Testing Dict.Array')
        self.error_exists(inserted_keys, path = self._get_path('child', levels-2)+'.array[-5]', error="Memcached error #194 'Invalid path'", field = 'Invalid path', result  = result)

        '''path too big'''
        self.log.info('Testing Intermediate element Dict. Array')
        self.error_exists(inserted_keys, path = self._get_path('child', 40), error="Memcached error #195 'Path too big'", field = 'path too big', result  = result)

        '''Malformed path'''
        self.log.info('Testing Malformed path Dict. Array')
        self.error_exists(inserted_keys, path = self._get_path('child', levels-2)+'.`array[0]`', error="Memcached error #192 'Path not exists'", field = 'Malformed path', result  = result)

        '''Invalid Path'''
        self.log.info('Testing ENOENT')
        self.error_exists(inserted_keys, path = self._get_path('child', levels-2)+'.array[100]', error="Memcached error #192 'Path not exists'", field = 'Invalid Path', result  = result)

        '''Path too long'''
        data_set_long = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys_long, levels_long = data_set_long.load(long_path=True)
        self.log.info('Testing long path ')
        self.error_exists(inserted_keys_long, path = self._get_path('child12345678901234567890123456789', levels_long), error="Memcached error #192 'Path too long'", field = 'Path too long', result  = result)
        self.assertTrue(len(result) > 0, result)
예제 #4
0
    def error_test_deep_nested_dataset_replace(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info("description : Error testing path error for CMD_REPLACE for deep nested dataset "
                      "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys,levels = data_set.load()

        '''path does not exist'''
        self.log.info('Testing path not exists')
        self.error_delete(inserted_keys, path = self._get_path('child', levels)+'.child', error="Memcached error #192 'Path not exists'", field = 'path does not exist', result  = result)

        '''Last element Array of Array'''
        last_path ='child'
        for i in xrange(levels-3):
            last_path +='.child'
        last_path +='.array[-1]'
        #data_set.get_all_docs(inserted_keys, path = last_path)

        '''path does not exist on array'''
        self.log.info('Testing path not exists on dict.array with array [--1]')
        self.error_replace(inserted_keys, path = last_path+'[-1]', error="Memcached error #193 'Path mismatch'", replace_str=1000000, field = 'path does not exist on array', result  = result)

        '''path missing replace string array Memcached error #4 'Invalid and Cant Insert'''
        self.log.info('Testing path not exists on dict.array with array [--1]')
        self.error_replace(inserted_keys, path = last_path+'[-1]', error="Memcached error #193 'Path mismatch'", replace_str='abc', field = 'path missing replace string array', result  = result)
        self.assertTrue(len(result) > 0, result)
예제 #5
0
    def error_test_deep_nested_dataset_dict_add(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info("description : Error testing path error for CMD_DICT_ADD for deep nested dataset "
                      "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys,levels = data_set.load()

        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_add_dict(inserted_keys, add_str = 'child', path = self._get_path('child', levels-2), error="Memcached error #197 'Cant insert'", field = 'Testing empty path for dictionary', result  = result)

        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_add_dict(inserted_keys, add_str="new_value", path = self._get_path('child', levels-2), error="Memcached error #197 'Cant insert'", field = 'path does not exist', result  = result)
        self.assertTrue(len(result) > 0, result)

        ''' Change error behaviour , there is something wrong on the call '''
예제 #6
0
    def error_test_deep_nested_dataset_delete(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info(
            "description : Error testing path error for CMD_delete for deep nested dataset "
            "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys, levels = data_set.load()
        '''path does not exist'''
        self.log.info('Testing path not exists')
        self.error_delete(inserted_keys,
                          path=self._get_path('child', levels) + '.child',
                          error="Memcached error #192 'Path not exists'",
                          field='path does not exist',
                          result=result)
        '''Last element Array of Array'''
        last_path = 'child'
        for i in xrange(levels - 3):
            last_path += '.child'
        last_path += '.array[-1]'
        #data_set.get_all_docs(inserted_keys, path = last_path)
        '''path does not exist on array'''
        self.log.info('Testing path not exists on dict.array with array [-5]')
        self.error_delete(inserted_keys,
                          path=last_path + '[-1]',
                          error="Memcached error #193 'Path mismatch'",
                          field='path does not exist on array - Path mismatch',
                          result=result)
        self.error_delete(inserted_keys,
                          path=last_path + '[-5]',
                          error="Memcached error #194 'Invalid path'",
                          field='path does not exist on array - Invalid path',
                          result=result)
        '''path missing CHECK if this error is expected.'''
        self.log.info('Testing path missing delete')
        self.error_delete(inserted_keys,
                          path='',
                          error="Memcached error #4 'Invalid'",
                          field='Testing path missing delete',
                          result=result)
        self.assertTrue(len(result) > 0, result)
예제 #7
0
    def error_test_deep_nested_dataset_dict_upsert(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info("description : Error testing path error for CMD_DICT_UPSERT for deep nested dataset "
                      "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys,levels = data_set.load()

        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_upsert_dict(inserted_keys, add_str = 'child', path = self._get_path('child', levels-2), error="Memcached error #197 'Cant insert'", field = 'path does not exist', result  = result)

        '''path does not exist'''
        self.log.info('Testing empty path for dictionary')
        self.error_upsert_dict(inserted_keys, add_str="new_value", path = self._get_path('child', levels-2), error="Memcached error #197 'Cant insert'", field = 'path does not exist', result  = result)

        '''document does not exist'''
        self.log.info('Document does not exist')
        self.error_upsert_dict(['key_does_not_exist'], add_str="new_value", path = "does_not_matter", error="Memcached error #197 'Cant insert'", field = 'Document does not exist', result  = result)
        self.assertTrue(len(result) == 0, result)
예제 #8
0
    def error_test_deep_nested_dataset_exists(self):
        result = {}
        num_docs = self.helper.input.param("num-docs")
        self.log.info(
            "description : Error testing path error for CMD_EXISTS for deep nested dataset "
            "dataset with {0} docs".format(num_docs))

        data_set = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys, levels = data_set.load()
        '''path does not exist'''
        self.log.info('Testing last+1 element dictionary')
        self.error_exists(inserted_keys,
                          path=self._get_path('child', levels + 1),
                          error="Memcached error #192 'Path not exists'",
                          field='path does not exist',
                          result=result)
        '''Invalid path'''
        self.log.info('Testing Dict.Array')
        self.error_exists(inserted_keys,
                          path=self._get_path('child', levels - 2) +
                          '.array[-5]',
                          error="Memcached error #194 'Invalid path'",
                          field='Invalid path',
                          result=result)
        '''path too big'''
        self.log.info('Testing Intermediate element Dict. Array')
        self.error_exists(inserted_keys,
                          path=self._get_path('child', 40),
                          error="Memcached error #195 'Path too big'",
                          field='path too big',
                          result=result)
        '''Malformed path'''
        self.log.info('Testing Malformed path Dict. Array')
        self.error_exists(inserted_keys,
                          path=self._get_path('child', levels - 2) +
                          '.`array[0]`',
                          error="Memcached error #192 'Path not exists'",
                          field='Malformed path',
                          result=result)
        '''Invalid Path'''
        self.log.info('Testing ENOENT')
        self.error_exists(inserted_keys,
                          path=self._get_path('child', levels - 2) +
                          '.array[100]',
                          error="Memcached error #192 'Path not exists'",
                          field='Invalid Path',
                          result=result)
        '''Path too long'''
        data_set_long = DeeplyNestedDataSet(self.helper, num_docs)
        inserted_keys_long, levels_long = data_set_long.load(long_path=True)
        self.log.info('Testing long path ')
        self.error_exists(inserted_keys_long,
                          path=self._get_path(
                              'child12345678901234567890123456789',
                              levels_long),
                          error="Memcached error #192 'Path too long'",
                          field='Path too long',
                          result=result)
        self.assertTrue(len(result) > 0, result)