Merge "Fix for failing kombu gate"
This commit is contained in:
commit
a93326f478
@ -122,6 +122,8 @@ class MistralSecureModelBase(MistralModelBase):
|
|||||||
|
|
||||||
scope = sa.Column(sa.String(80), default='private')
|
scope = sa.Column(sa.String(80), default='private')
|
||||||
project_id = sa.Column(sa.String(80), default=security.get_project_id)
|
project_id = sa.Column(sa.String(80), default=security.get_project_id)
|
||||||
|
created_at = sa.Column(sa.DateTime, default=lambda: utils.utc_now_sec())
|
||||||
|
updated_at = sa.Column(sa.DateTime, onupdate=lambda: utils.utc_now_sec())
|
||||||
|
|
||||||
|
|
||||||
def _set_project_id(target, value, oldvalue, initiator):
|
def _set_project_id(target, value, oldvalue, initiator):
|
||||||
|
@ -40,7 +40,8 @@ WORKBOOKS = [
|
|||||||
'scope': 'public',
|
'scope': 'public',
|
||||||
'updated_at': None,
|
'updated_at': None,
|
||||||
'project_id': '1233',
|
'project_id': '1233',
|
||||||
'trust_id': '1234'
|
'trust_id': '1234',
|
||||||
|
'created_at': datetime.datetime(2016, 12, 1, 15, 0, 0)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'my_workbook2',
|
'name': 'my_workbook2',
|
||||||
@ -51,7 +52,8 @@ WORKBOOKS = [
|
|||||||
'scope': 'private',
|
'scope': 'private',
|
||||||
'updated_at': None,
|
'updated_at': None,
|
||||||
'project_id': '1233',
|
'project_id': '1233',
|
||||||
'trust_id': '12345'
|
'trust_id': '12345',
|
||||||
|
'created_at': datetime.datetime(2016, 12, 1, 15, 1, 0)
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -368,7 +370,8 @@ WF_DEFINITIONS = [
|
|||||||
'tags': ['mc'],
|
'tags': ['mc'],
|
||||||
'scope': 'public',
|
'scope': 'public',
|
||||||
'project_id': '1233',
|
'project_id': '1233',
|
||||||
'trust_id': '1234'
|
'trust_id': '1234',
|
||||||
|
'created_at': datetime.datetime(2016, 12, 1, 15, 0, 0)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'my_wf2',
|
'name': 'my_wf2',
|
||||||
@ -377,7 +380,8 @@ WF_DEFINITIONS = [
|
|||||||
'tags': ['mc'],
|
'tags': ['mc'],
|
||||||
'scope': 'private',
|
'scope': 'private',
|
||||||
'project_id': '1233',
|
'project_id': '1233',
|
||||||
'trust_id': '12345'
|
'trust_id': '12345',
|
||||||
|
'created_at': datetime.datetime(2016, 12, 1, 15, 1, 0)
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -830,7 +834,8 @@ ACTION_DEFINITIONS = [
|
|||||||
'is_system': True,
|
'is_system': True,
|
||||||
'action_class': 'mypackage.my_module.Action1',
|
'action_class': 'mypackage.my_module.Action1',
|
||||||
'attributes': None,
|
'attributes': None,
|
||||||
'project_id': '<default-project>'
|
'project_id': '<default-project>',
|
||||||
|
'created_at': datetime.datetime(2016, 12, 1, 15, 0, 0)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'action2',
|
'name': 'action2',
|
||||||
@ -838,7 +843,8 @@ ACTION_DEFINITIONS = [
|
|||||||
'is_system': True,
|
'is_system': True,
|
||||||
'action_class': 'mypackage.my_module.Action2',
|
'action_class': 'mypackage.my_module.Action2',
|
||||||
'attributes': None,
|
'attributes': None,
|
||||||
'project_id': '<default-project>'
|
'project_id': '<default-project>',
|
||||||
|
'created_at': datetime.datetime(2016, 12, 1, 15, 1, 0)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'action3',
|
'name': 'action3',
|
||||||
@ -847,7 +853,8 @@ ACTION_DEFINITIONS = [
|
|||||||
'tags': ['mc', 'abc'],
|
'tags': ['mc', 'abc'],
|
||||||
'action_class': 'mypackage.my_module.Action3',
|
'action_class': 'mypackage.my_module.Action3',
|
||||||
'attributes': None,
|
'attributes': None,
|
||||||
'project_id': '<default-project>'
|
'project_id': '<default-project>',
|
||||||
|
'created_at': datetime.datetime(2016, 12, 1, 15, 2, 0)
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1308,7 +1315,7 @@ WF_EXECS = [
|
|||||||
'start_params': {'task': 'my_task1'},
|
'start_params': {'task': 'my_task1'},
|
||||||
'state': 'IDLE',
|
'state': 'IDLE',
|
||||||
'state_info': "Running...",
|
'state_info': "Running...",
|
||||||
'created_at': None,
|
'created_at': datetime.datetime(2016, 12, 1, 15, 0, 0),
|
||||||
'updated_at': None,
|
'updated_at': None,
|
||||||
'context': None,
|
'context': None,
|
||||||
'task_id': None,
|
'task_id': None,
|
||||||
@ -1321,7 +1328,7 @@ WF_EXECS = [
|
|||||||
'start_params': {'task': 'my_task1'},
|
'start_params': {'task': 'my_task1'},
|
||||||
'state': 'RUNNING',
|
'state': 'RUNNING',
|
||||||
'state_info': "Running...",
|
'state_info': "Running...",
|
||||||
'created_at': None,
|
'created_at': datetime.datetime(2016, 12, 1, 15, 1, 0),
|
||||||
'updated_at': None,
|
'updated_at': None,
|
||||||
'context': {'image_id': '123123'},
|
'context': {'image_id': '123123'},
|
||||||
'task_id': None,
|
'task_id': None,
|
||||||
@ -1647,7 +1654,7 @@ TASK_EXECS = [
|
|||||||
'tags': ['deployment'],
|
'tags': ['deployment'],
|
||||||
'in_context': None,
|
'in_context': None,
|
||||||
'runtime_context': None,
|
'runtime_context': None,
|
||||||
'created_at': None,
|
'created_at': datetime.datetime(2016, 12, 1, 15, 0, 0),
|
||||||
'updated_at': None
|
'updated_at': None
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1660,7 +1667,7 @@ TASK_EXECS = [
|
|||||||
'tags': ['deployment'],
|
'tags': ['deployment'],
|
||||||
'in_context': {'image_id': '123123'},
|
'in_context': {'image_id': '123123'},
|
||||||
'runtime_context': None,
|
'runtime_context': None,
|
||||||
'created_at': None,
|
'created_at': datetime.datetime(2016, 12, 1, 15, 1, 0),
|
||||||
'updated_at': None
|
'updated_at': None
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -759,13 +759,17 @@ class DirectWorkflowRerunTest(base.EngineTestCase):
|
|||||||
'Task 1.2 [%s]' % updated_env['var1'] # Task 1 item 2 (rerun).
|
'Task 1.2 [%s]' % updated_env['var1'] # Task 1 item 2 (rerun).
|
||||||
]
|
]
|
||||||
|
|
||||||
result = zip(task_1_action_exs, expected_inputs)
|
# Assert that every expected input is in actual task input.
|
||||||
|
for action_ex in task_1_action_exs:
|
||||||
|
self.assertIn(action_ex.input['output'], expected_inputs)
|
||||||
|
|
||||||
for (action_ex, expected_input) in result:
|
# Assert that there was same number of unique inputs as action execs.
|
||||||
self.assertDictEqual(
|
self.assertEqual(
|
||||||
{'output': expected_input},
|
len(task_1_action_exs),
|
||||||
action_ex.input
|
len(set(
|
||||||
)
|
[action_ex.input['output'] for action_ex in task_1_action_exs]
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
# Check action executions of task 2.
|
# Check action executions of task 2.
|
||||||
self.assertEqual(states.SUCCESS, task_2_ex.state)
|
self.assertEqual(states.SUCCESS, task_2_ex.state)
|
||||||
|
@ -269,16 +269,33 @@ class ReverseWorkflowRerunTest(base.EngineTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(2, len(task_2_action_exs))
|
self.assertEqual(2, len(task_2_action_exs))
|
||||||
self.assertEqual(states.ERROR, task_2_action_exs[0].state)
|
|
||||||
self.assertEqual(states.SUCCESS, task_2_action_exs[1].state)
|
|
||||||
|
|
||||||
self.assertDictEqual(
|
# Assert that one action ex is in error and one in success states.
|
||||||
{'output': env['var1']},
|
self.assertIn(
|
||||||
task_2_action_exs[0].input
|
task_2_action_exs[0].state,
|
||||||
|
[states.ERROR, states.SUCCESS]
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
task_2_action_exs[1].state,
|
||||||
|
[states.ERROR, states.SUCCESS]
|
||||||
|
)
|
||||||
|
self.assertNotEqual(
|
||||||
|
task_2_action_exs[0].state,
|
||||||
|
task_2_action_exs[1].state
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertDictEqual(
|
# Assert that one action ex got first env and one got second env
|
||||||
{'output': updated_env['var1']},
|
self.assertIn(
|
||||||
|
task_2_action_exs[0].input['output'],
|
||||||
|
[env['var1'], updated_env['var1']]
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
task_2_action_exs[1].input['output'],
|
||||||
|
[env['var1'], updated_env['var1']]
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertNotEqual(
|
||||||
|
task_2_action_exs[0].input,
|
||||||
task_2_action_exs[1].input
|
task_2_action_exs[1].input
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -151,6 +151,21 @@ class ExecutionStateInfoTest(base.EngineTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(3, len(task_1_action_exs))
|
self.assertEqual(3, len(task_1_action_exs))
|
||||||
self.assertIn(task_1_action_exs[0].id, wf_ex.state_info)
|
|
||||||
self.assertNotIn(task_1_action_exs[1].id, wf_ex.state_info)
|
error_actions = [
|
||||||
self.assertIn(task_1_action_exs[2].id, wf_ex.state_info)
|
action_ex for action_ex in task_1_action_exs if
|
||||||
|
action_ex.state == states.ERROR
|
||||||
|
]
|
||||||
|
self.assertEqual(2, len(error_actions))
|
||||||
|
|
||||||
|
success_actions = [
|
||||||
|
action_ex for action_ex in task_1_action_exs if
|
||||||
|
action_ex.state == states.SUCCESS
|
||||||
|
]
|
||||||
|
self.assertEqual(1, len(success_actions))
|
||||||
|
|
||||||
|
for action_ex in error_actions:
|
||||||
|
self.assertIn(action_ex.id, wf_ex.state_info)
|
||||||
|
|
||||||
|
for action_ex in success_actions:
|
||||||
|
self.assertNotIn(action_ex.id, wf_ex.state_info)
|
||||||
|
@ -31,6 +31,7 @@ import threading
|
|||||||
import eventlet
|
import eventlet
|
||||||
from eventlet import corolocal
|
from eventlet import corolocal
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
|
from oslo_utils import timeutils
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import pkg_resources as pkg
|
import pkg_resources as pkg
|
||||||
import random
|
import random
|
||||||
@ -366,3 +367,10 @@ def generate_key_pair(key_length=2048):
|
|||||||
public_key = open(public_key_path).read()
|
public_key = open(public_key_path).read()
|
||||||
|
|
||||||
return private_key, public_key
|
return private_key, public_key
|
||||||
|
|
||||||
|
|
||||||
|
def utc_now_sec():
|
||||||
|
"""Returns current time and drops microseconds."""
|
||||||
|
|
||||||
|
d = timeutils.utcnow()
|
||||||
|
return d.replace(microsecond=0)
|
||||||
|
Loading…
Reference in New Issue
Block a user