Fix test not waiting for action to be created
Change-Id: I415bb3fbefa91da0e7aaca9fe5d3714989ffda69 Signed-off-by: Oleg Ovcharuk <vgvoleg@gmail.com>
This commit is contained in:
parent
d6b7f7305d
commit
5cb9cb74e5
|
@ -199,6 +199,11 @@ class EngineTestCase(base.DbTestCase):
|
||||||
def is_action_in_state(self, ex_id, state):
|
def is_action_in_state(self, ex_id, state):
|
||||||
return db_api.get_action_execution(ex_id).state == state
|
return db_api.get_action_execution(ex_id).state == state
|
||||||
|
|
||||||
|
def is_action_created(self, task_ex_id):
|
||||||
|
return bool(db_api.get_action_executions(
|
||||||
|
task_execution_id=task_ex_id
|
||||||
|
))
|
||||||
|
|
||||||
def await_action_state(self, ex_id, state, delay=DEFAULT_DELAY,
|
def await_action_state(self, ex_id, state, delay=DEFAULT_DELAY,
|
||||||
timeout=DEFAULT_TIMEOUT):
|
timeout=DEFAULT_TIMEOUT):
|
||||||
self._await(
|
self._await(
|
||||||
|
@ -274,6 +279,14 @@ class EngineTestCase(base.DbTestCase):
|
||||||
timeout=DEFAULT_TIMEOUT):
|
timeout=DEFAULT_TIMEOUT):
|
||||||
self._await(lambda: self.is_task_processed(ex_id), delay, timeout)
|
self._await(lambda: self.is_task_processed(ex_id), delay, timeout)
|
||||||
|
|
||||||
|
def await_task_creates_action(self, ex_id, delay=DEFAULT_DELAY,
|
||||||
|
timeout=DEFAULT_TIMEOUT):
|
||||||
|
self._await(
|
||||||
|
lambda: self.is_action_created(ex_id),
|
||||||
|
delay,
|
||||||
|
timeout
|
||||||
|
)
|
||||||
|
|
||||||
# Various methods for workflow execution objects.
|
# Various methods for workflow execution objects.
|
||||||
|
|
||||||
def is_workflow_in_state(self, ex_id, state):
|
def is_workflow_in_state(self, ex_id, state):
|
||||||
|
|
|
@ -181,6 +181,7 @@ class TaskCancelTest(base.EngineTestCase):
|
||||||
name='task1'
|
name='task1'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.await_task_creates_action(task_1_ex.id)
|
||||||
task_1_action_exs = db_api.get_action_executions(
|
task_1_action_exs = db_api.get_action_executions(
|
||||||
task_execution_id=task_1_ex.id
|
task_execution_id=task_1_ex.id
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue