From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
When executed all Kimchi tests (by run_tests.sh), the test_async_tasks is
falling due to wrong check of the number of the current task added to be
executed. This happens because the control of the task_id is handled by a
global variable in Wok, increased by 1 each time a new task is added.
This patch uses the wok.utils method get_task_id() to get the current value
of the task_id controlled by Wok.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
tests/test_model.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index 0108015..0ac36dd 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -34,7 +34,7 @@ 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
+from wok.utils import add_task, get_task_id
from wok.xmlutils.utils import xpath_get_text
from wok.plugins.kimchi import netinfo
@@ -939,14 +939,14 @@ class ModelTests(unittest.TestCase):
objstore_loc=self.tmp_store)
taskid = add_task('', quick_op, inst.objstore, 'Hello')
inst.task_wait(taskid)
- self.assertEquals(1, 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'})
- self.assertEquals(2, taskid)
+ self.assertEquals(get_task_id(), taskid)
self.assertEquals('running', inst.task_lookup(taskid)['status'])
self.assertEquals('OK', inst.task_lookup(taskid)['message'])
inst.task_wait(taskid)
--
2.5.0