Apply input schema to workflow/action input
* apply the schema introduced in previous patch(https://review.openstack.org/#/c/172438/). * add some unit tests accordingly. things need to be done in the subsequent patches: - consider the input default value when validating inputs of workflow/action. - add some unit tests for input default value. - add some samples in mistral-extra repository if needed. Partially Implements: blueprint mistral-default-input-values Change-Id: I9737dbffe0e6913d976990fbdc31086539b5956e
This commit is contained in:
parent
178de6396d
commit
762fe93576
@ -73,7 +73,12 @@ class ActionSpecValidation(base.WorkbookSpecValidationTestCase):
|
||||
({'input': ['']}, True),
|
||||
({'input': None}, True),
|
||||
({'input': ['k1', 'k2']}, False),
|
||||
({'input': ['k1', 12345]}, True)
|
||||
({'input': ['k1', 12345]}, True),
|
||||
({'input': ['k1', {'k2': 2}]}, False),
|
||||
({'input': [{'k1': 1}, {'k2': 2}]}, False),
|
||||
({'input': [{'k1': None}]}, False),
|
||||
({'input': [{'k1': 1}, {'k1': 1}]}, True),
|
||||
({'input': [{'k1': 1, 'k2': 2}]}, True)
|
||||
]
|
||||
|
||||
actions = {
|
||||
|
@ -132,7 +132,12 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase):
|
||||
({'input': [None]}, True),
|
||||
({'input': ['']}, True),
|
||||
({'input': None}, True),
|
||||
({'input': []}, True)
|
||||
({'input': []}, True),
|
||||
({'input': ['var1', {'var2': 2}]}, False),
|
||||
({'input': [{'var1': 1}, {'var2': 2}]}, False),
|
||||
({'input': [{'var1': None}]}, False),
|
||||
({'input': [{'var1': 1}, {'var1': 1}]}, True),
|
||||
({'input': [{'var1': 1, 'var2': 2}]}, True)
|
||||
]
|
||||
|
||||
for wf_input, expect_error in tests:
|
||||
|
@ -25,7 +25,7 @@ class ActionSpec(base.BaseSpec):
|
||||
"properties": {
|
||||
"base": types.NONEMPTY_STRING,
|
||||
"base-input": types.NONEMPTY_DICT,
|
||||
"input": types.UNIQUE_STRING_LIST,
|
||||
"input": types.UNIQUE_STRING_OR_ONE_KEY_DICT_LIST,
|
||||
"output": types.ANY_NULLABLE,
|
||||
},
|
||||
"required": ["base"],
|
||||
|
@ -37,7 +37,7 @@ class WorkflowSpec(base.BaseSpec):
|
||||
"properties": {
|
||||
"type": types.WORKFLOW_TYPE,
|
||||
"task-defaults": _task_defaults_schema,
|
||||
"input": types.UNIQUE_STRING_LIST,
|
||||
"input": types.UNIQUE_STRING_OR_ONE_KEY_DICT_LIST,
|
||||
"output": types.NONEMPTY_DICT,
|
||||
"tasks": {
|
||||
"type": "object",
|
||||
|
Loading…
Reference in New Issue
Block a user