def setUp(self): """Resets the size limit config between tests""" super(ExecutionFieldsSizeLimitTest, self).setUp() cfg.CONF.set_default('execution_field_size_limit_kb', 0, group='engine') test_base.register_action_class('my_action', MyAction)
def test_join_task_with_input_error(self): test_base.register_action_class('my_action', ActionWithExceptionInInit) wf_text = """--- version: '2.0' wf: type: direct tasks: join_task: action: my_action aaa="aaa" join: all task1: on-success: join_task task2: on-success: join_task """ wf_service.create_workflows(wf_text) wf_ex = self.engine.start_workflow('wf') self.await_workflow_error(wf_ex.id) with db_api.transaction(): wf_ex = db_api.get_workflow_execution(wf_ex.id) t_execs = wf_ex.task_executions self._assert_single_item(t_execs, name='task1', state=states.SUCCESS) self._assert_single_item(t_execs, name='task2', state=states.SUCCESS) self._assert_single_item(t_execs, name='join_task', state=states.ERROR)
def setUp(self): super(EngineActionRaceConditionTest, self).setUp() global ACTION_SEMAPHORE global TEST_SEMAPHORE ACTION_SEMAPHORE = semaphore.Semaphore(1) TEST_SEMAPHORE = semaphore.Semaphore(0) test_base.register_action_class('test.block', BlockingAction)
def setUp(self): super(LongActionTest, self).setUp() global ACTION_SEMAPHORE global TEST_SEMAPHORE ACTION_SEMAPHORE = semaphore.Semaphore(1) TEST_SEMAPHORE = semaphore.Semaphore(0) test_base.register_action_class('test.block', BlockingAction)
def setUp(self): """Resets the size limit config between tests""" super(ExecutionFieldsSizeLimitTest, self).setUp() cfg.CONF.set_default( 'execution_field_size_limit_kb', 0, group='engine' ) test_base.register_action_class('my_action', MyAction)
def test_with_items_results_order(self): wb_text = """--- version: "2.0" name: wb1 workflows: with_items: type: direct tasks: task1: with-items: i in [1, 2, 3] action: sleep_echo output=<% $.i %> publish: one_two_three: <% task(task1).result %> """ # Register random sleep action in the DB. test_base.register_action_class('sleep_echo', RandomSleepEchoAction) wb_service.create_workbook_v2(wb_text) # Start workflow. wf_ex = self.engine.start_workflow('wb1.with_items', {}) self.await_workflow_success(wf_ex.id) with db_api.transaction(): # Note: We need to reread execution to access related tasks. wf_ex = db_api.get_workflow_execution(wf_ex.id) task_execs = wf_ex.task_executions task1_ex = self._assert_single_item( task_execs, name='task1', state=states.SUCCESS ) published = task1_ex.published # Now we can check order of results explicitly. self.assertEqual([1, 2, 3], published['one_two_three'])
def test_with_items_results_order(self): wb_text = """--- version: "2.0" name: wb1 workflows: with_items: type: direct tasks: task1: with-items: i in [1, 2, 3] action: sleep_echo output=<% $.i %> publish: one_two_three: <% task(task1).result %> """ # Register random sleep action in the DB. test_base.register_action_class('sleep_echo', RandomSleepEchoAction) wb_service.create_workbook_v2(wb_text) # Start workflow. wf_ex = self.engine.start_workflow('wb1.with_items', {}) self.await_workflow_success(wf_ex.id) with db_api.transaction(): # Note: We need to reread execution to access related tasks. wf_ex = db_api.get_workflow_execution(wf_ex.id) task_execs = wf_ex.task_executions task1_ex = self._assert_single_item( task_execs, name='task1', state=states.SUCCESS ) published = task1_ex.published # Now we can check order of results explicitly. self.assertEqual([1, 2, 3], published['one_two_three'])
def setUp(self): super(ActionContextTest, self).setUp() test_base.register_action_class('my_action', MyAction)
def setUp(self): super(ErrorResultTest, self).setUp() test_base.register_action_class('my_action', MyAction)
def setUp(self): super(ActionContextTest, self).setUp() test_base.register_action_class('my_action', MyAction)