Merge "Added created_at and updated_at fields to functions task() and exection()"

This commit is contained in:
Jenkins 2017-10-06 10:43:40 +00:00 committed by Gerrit Code Review
commit 93098293ab
3 changed files with 29 additions and 10 deletions

@ -205,7 +205,9 @@ class JinjaEvaluatorTest(base.BaseTest):
'state': task.state,
'state_info': task.state_info,
'type': task.type,
'workflow_execution_id': task.workflow_execution_id
'workflow_execution_id': task.workflow_execution_id,
'created_at': task.created_at.isoformat(' '),
'updated_at': task.updated_at.isoformat(' ')
}, result)
@mock.patch('mistral.db.v2.api.get_task_executions')
@ -232,7 +234,9 @@ class JinjaEvaluatorTest(base.BaseTest):
'state': task.state,
'state_info': task.state_info,
'type': task.type,
'workflow_execution_id': task.workflow_execution_id
'workflow_execution_id': task.workflow_execution_id,
'created_at': task.created_at.isoformat(' '),
'updated_at': task.updated_at.isoformat(' ')
}], result)
@mock.patch('mistral.db.v2.api.get_task_execution')
@ -257,7 +261,9 @@ class JinjaEvaluatorTest(base.BaseTest):
'state': task_execution().state,
'state_info': task_execution().state_info,
'type': task_execution().type,
'workflow_execution_id': task_execution().workflow_execution_id
'workflow_execution_id': task_execution().workflow_execution_id,
'created_at': task_execution().created_at.isoformat(' '),
'updated_at': task_execution().updated_at.isoformat(' ')
}, result)
@mock.patch('mistral.db.v2.api.get_task_execution')
@ -281,7 +287,9 @@ class JinjaEvaluatorTest(base.BaseTest):
'state': task_execution().state,
'state_info': task_execution().state_info,
'type': task_execution().type,
'workflow_execution_id': task_execution().workflow_execution_id
'workflow_execution_id': task_execution().workflow_execution_id,
'created_at': task_execution().created_at.isoformat(' '),
'updated_at': task_execution().updated_at.isoformat(' ')
}, result)
@mock.patch('mistral.db.v2.api.get_workflow_execution')
@ -302,7 +310,8 @@ class JinjaEvaluatorTest(base.BaseTest):
'spec': wf_ex.spec,
'input': wf_ex.input,
'params': wf_ex.params,
'created_at': wf_ex.created_at.isoformat(' ')
'created_at': wf_ex.created_at.isoformat(' '),
'updated_at': wf_ex.updated_at.isoformat(' ')
}, result)
@mock.patch('mistral.db.v2.api.get_workflow_execution')
@ -323,7 +332,8 @@ class JinjaEvaluatorTest(base.BaseTest):
'spec': wf_ex.spec,
'input': wf_ex.input,
'params': wf_ex.params,
'created_at': wf_ex.created_at.isoformat(' ')
'created_at': wf_ex.created_at.isoformat(' '),
'updated_at': wf_ex.updated_at.isoformat(' ')
}, result)

@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime
from mistral import exceptions as exc
from mistral.expressions import yaql_expression as expr
from mistral.tests.unit import base
@ -143,6 +144,7 @@ class YaqlEvaluatorTest(base.BaseTest):
task_executions):
task_execution_result.return_value = 'task_execution_result'
time_now = utils.utc_now_sec()
task = type("obj", (object,), {
'id': 'id',
'name': 'name',
@ -152,7 +154,9 @@ class YaqlEvaluatorTest(base.BaseTest):
'state': 'state',
'state_info': 'state_info',
'type': 'type',
'workflow_execution_id': 'workflow_execution_id'
'workflow_execution_id': 'workflow_execution_id',
'created_at': time_now,
'updated_at': time_now + datetime.timedelta(seconds=1),
})()
task_executions.return_value = [task]
@ -176,7 +180,9 @@ class YaqlEvaluatorTest(base.BaseTest):
'state': task.state,
'state_info': task.state_info,
'type': task.type,
'workflow_execution_id': task.workflow_execution_id
'workflow_execution_id': task.workflow_execution_id,
'created_at': task.created_at.isoformat(' '),
'updated_at': task.updated_at.isoformat(' ')
}, result[0])
def test_function_env(self):

@ -109,7 +109,8 @@ def execution_(context):
'spec': wf_ex.spec,
'input': wf_ex.input,
'params': wf_ex.params,
'created_at': wf_ex.created_at.isoformat(' ')
'created_at': wf_ex.created_at.isoformat(' '),
'updated_at': wf_ex.updated_at.isoformat(' ')
}
@ -256,7 +257,9 @@ def _convert_to_user_model(task_ex):
'result': data_flow.get_task_execution_result(task_ex),
'published': task_ex.published,
'type': task_ex.type,
'workflow_execution_id': task_ex.workflow_execution_id
'workflow_execution_id': task_ex.workflow_execution_id,
'created_at': task_ex.created_at.isoformat(' '),
'updated_at': task_ex.updated_at.isoformat(' ')
}