summaryrefslogtreecommitdiff
path: root/taskflow/tests/unit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2015-06-17 23:34:31 -0700
committerJoshua Harlow <harlowja@gmail.com>2015-06-18 07:41:25 -0700
commit2fa4af7a24584b211ca549f2df715c2d126360c8 (patch)
tree87bbb400dca07e484efc22961670a5f963e13c85 /taskflow/tests/unit
parentcaf37be3456dd3a0a03624afc8c25bcd20459e02 (diff)
downloadtaskflow-2fa4af7a24584b211ca549f2df715c2d126360c8.tar.gz
Split-off the additional retry states from the task states
Split the states that are not task states (but are retry states) into there own additional set and then use that set and a new function to validate the transition at other locations in the code-base. This makes the transitions that are valid for tasks/retries easily viewable, more easy to read and understand, and more correct (instead of being a mix of task + retry atom transitions and states). Change-Id: I9515c19daf59a21e581f51e757ece2050f348214
Diffstat (limited to 'taskflow/tests/unit')
-rw-r--r--taskflow/tests/unit/action_engine/test_runner.py6
-rw-r--r--taskflow/tests/unit/test_check_transition.py17
2 files changed, 20 insertions, 3 deletions
diff --git a/taskflow/tests/unit/action_engine/test_runner.py b/taskflow/tests/unit/action_engine/test_runner.py
index 98ae0e2..eb0f0a2 100644
--- a/taskflow/tests/unit/action_engine/test_runner.py
+++ b/taskflow/tests/unit/action_engine/test_runner.py
@@ -45,8 +45,10 @@ class _RunnerTestMixin(object):
task_executor = executor.SerialTaskExecutor()
task_executor.start()
self.addCleanup(task_executor.stop)
- return runtime.Runtime(compilation, store,
- task_notifier, task_executor)
+ r = runtime.Runtime(compilation, store,
+ task_notifier, task_executor)
+ r.compile()
+ return r
class RunnerTest(test.TestCase, _RunnerTestMixin):
diff --git a/taskflow/tests/unit/test_check_transition.py b/taskflow/tests/unit/test_check_transition.py
index bed7bc9..7c820fd 100644
--- a/taskflow/tests/unit/test_check_transition.py
+++ b/taskflow/tests/unit/test_check_transition.py
@@ -87,7 +87,7 @@ class CheckTaskTransitionTest(TransitionTest):
def test_from_success_state(self):
self.assertTransitions(from_state=states.SUCCESS,
- allowed=(states.REVERTING, states.RETRYING),
+ allowed=(states.REVERTING,),
ignored=(states.RUNNING, states.SUCCESS,
states.PENDING, states.FAILURE,
states.REVERTED))
@@ -112,6 +112,21 @@ class CheckTaskTransitionTest(TransitionTest):
states.RUNNING,
states.SUCCESS, states.FAILURE))
+
+class CheckRetryTransitionTest(CheckTaskTransitionTest):
+
+ def setUp(self):
+ super(CheckRetryTransitionTest, self).setUp()
+ self.check_transition = states.check_retry_transition
+ self.transition_exc_regexp = '^Retry transition.*not allowed'
+
+ def test_from_success_state(self):
+ self.assertTransitions(from_state=states.SUCCESS,
+ allowed=(states.REVERTING, states.RETRYING),
+ ignored=(states.RUNNING, states.SUCCESS,
+ states.PENDING, states.FAILURE,
+ states.REVERTED))
+
def test_from_retrying_state(self):
self.assertTransitions(from_state=states.RETRYING,
allowed=(states.RUNNING,),