[Kimchi-devel] [PATCH] [Kimchi] Update usage of add_task() method.
Lucio Correia
luciojhc at linux.vnet.ibm.com
Fri Aug 26 18:31:27 UTC 2016
Found error on Kimchi tests:
On 26-08-2016 11:18, pvital at linux.vnet.ibm.com wrote:
> From: Paulo Vital <pvital at linux.vnet.ibm.com>
(...)
> diff --git a/tests/test_model.py b/tests/test_model.py
> index e77d4fd..0a5d343 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -36,12 +36,13 @@ from mock import call, mock_open, patch
> import tests.utils as utils
>
> import wok.objectstore
> +from wok.asynctask import add_task
> from wok.basemodel import Singleton
> from wok.config import config
> from wok.exception import InvalidOperation
> from wok.exception import InvalidParameter, NotFoundError, OperationFailed
> from wok.rollbackcontext import RollbackContext
> -from wok.utils import add_task, convert_data_size, get_task_id
> +from wok.utils import convert_data_size, get_task_id
get_task_id was removed by Wok patch.
> from wok.xmlutils.utils import xpath_get_text
>
> from wok.plugins.gingerbase import netinfo
> @@ -1401,15 +1402,14 @@ class ModelTests(unittest.TestCase):
>
> inst = model.Model('test:///default',
> objstore_loc=self.tmp_store)
> - taskid = add_task('', quick_op, inst.objstore, 'Hello')
> + taskid = add_task('', quick_op, 'Hello')
> inst.task_wait(taskid)
> self.assertEquals(get_task_id(), taskid)
> self.assertEquals('finished', inst.task_lookup(taskid)['status'])
> self.assertEquals('Hello', inst.task_lookup(taskid)['message'])
>
> - taskid = add_task('', long_op, inst.objstore,
> - {'delay': 3, 'result': False,
> - 'message': 'It was not meant to be'})
> + taskid = add_task('', long_op, {'delay': 3, 'result': False,
> + 'message': 'It was not meant to be'})
> self.assertEquals(get_task_id(), taskid)
> self.assertEquals('running', inst.task_lookup(taskid)['status'])
> self.assertEquals('OK', inst.task_lookup(taskid)['message'])
> @@ -1417,14 +1417,13 @@ class ModelTests(unittest.TestCase):
> self.assertEquals('failed', inst.task_lookup(taskid)['status'])
> self.assertEquals('It was not meant to be',
> inst.task_lookup(taskid)['message'])
> - taskid = add_task('', abnormal_op, inst.objstore, {})
> + taskid = add_task('', abnormal_op, {})
> inst.task_wait(taskid)
> self.assertEquals('Exception raised',
> inst.task_lookup(taskid)['message'])
> self.assertEquals('failed', inst.task_lookup(taskid)['status'])
>
> - taskid = add_task('', continuous_ops, inst.objstore,
> - {'result': True})
> + taskid = add_task('', continuous_ops, {'result': True})
> self.assertEquals('running', inst.task_lookup(taskid)['status'])
> inst.task_wait(taskid, timeout=10)
> self.assertEquals('finished', inst.task_lookup(taskid)['status'])
> diff --git a/tests/test_rest.py b/tests/test_rest.py
> index 80596c2..483e5ff 100644
> --- a/tests/test_rest.py
> +++ b/tests/test_rest.py
> @@ -30,8 +30,8 @@ from functools import partial
> from tests.utils import get_free_port, patch_auth, request
> from tests.utils import run_server, wait_task
>
> +from wok.asynctask import add_task
> from wok.rollbackcontext import RollbackContext
> -from wok.utils import add_task
>
> from wok.plugins.kimchi import mockmodel
> from wok.plugins.kimchi.osinfo import get_template_default
> @@ -1305,12 +1305,9 @@ class RestTests(unittest.TestCase):
> )
>
> def test_tasks(self):
> - id1 = add_task('/plugins/kimchi/tasks/1', self._async_op,
> - model.objstore)
> - id2 = add_task('/plugins/kimchi/tasks/2', self._except_op,
> - model.objstore)
> - id3 = add_task('/plugins/kimchi/tasks/3', self._intermid_op,
> - model.objstore)
> + id1 = add_task('/plugins/kimchi/tasks/1', self._async_op)
> + id2 = add_task('/plugins/kimchi/tasks/2', self._except_op)
> + id3 = add_task('/plugins/kimchi/tasks/3', self._intermid_op)
>
> target_uri = urllib2.quote('^/plugins/kimchi/tasks/*', safe="")
> filter_data = 'status=running&target_uri=%s' % target_uri
>
--
Lucio Correia
Software Engineer
IBM LTC Brazil
More information about the Kimchi-devel
mailing list