16
16
from tests .message_queue import UnitTestMessageQueue
17
17
from tests .wapi_adapter import UnitTestWorkflowAPIAdapter
18
18
from workflow .workflow_engine import WorkflowEngine
19
+ from workflow .workflow_validator import (
20
+ ValidationLevel ,
21
+ ValidationResult ,
22
+ WorkflowValidator ,
23
+ )
19
24
20
25
21
26
@pytest .fixture
@@ -55,8 +60,9 @@ def start_workflow(
55
60
56
61
# To start a workflow we need to:
57
62
# 1. Load and create a Workflow Definition
58
- # 2. Create a Running Workflow record
59
- # 3. Send a Workflow START message
63
+ # 2. Validate the workflow for running
64
+ # 3. Create a Running Workflow record
65
+ # 4. Send a Workflow START message
60
66
#
61
67
# 1.
62
68
workflow_path = os .path .join (
@@ -68,6 +74,13 @@ def start_workflow(
68
74
wf_response = da .create_workflow (workflow_definition = wf_definition )
69
75
print (f"Created workflow definition { wf_response } " )
70
76
# 2.
77
+ vr_result : ValidationResult = WorkflowValidator .validate (
78
+ workflow_definition = wf_definition ,
79
+ workflow_inputs = variables ,
80
+ level = ValidationLevel .RUN ,
81
+ )
82
+ assert vr_result .error_num == 0
83
+ # 3.
71
84
response = da .create_running_workflow (
72
85
user_id = "dlister" ,
73
86
workflow_id = wf_response ["id" ],
0 commit comments