Update OnClauseSPec task name criteria
The OnClauseSpec required Task names to be \w+ or [a-zA-Z0-9_] which is not enforced by the DSL, so it was possible to have valid task names that could not be referenced in an on-clause. YAML enforces some restrictions on characters in task names (#, !, |) but other than that any JSON-schema valid string should be a valid Task name Change-Id: I3f1056cad7c67e160a082c2a0de2e3bfd476bc63 Closes-Bug: 1797439
This commit is contained in:
parent
9be7e928d6
commit
e98614cd60
@ -23,7 +23,7 @@ NEXT_TASK = {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^\w+$",
|
||||
"pattern": "^\S+$",
|
||||
"description": "Task name (e.g.: `task1`)"
|
||||
},
|
||||
{
|
||||
|
@ -432,6 +432,32 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase):
|
||||
str(exception)
|
||||
)
|
||||
|
||||
def test_task_name(self):
|
||||
wf = {
|
||||
'version': '2.0',
|
||||
'workflowname': {
|
||||
'type': 'direct',
|
||||
'tasks': {'task1': {'action': 'std.noop',
|
||||
'on-success': ['t2-task']},
|
||||
't2-task': {'action': 'std.noop',
|
||||
'on-success': ['t3.task']},
|
||||
't3.task': {'action': 'std.noop',
|
||||
'on-success': ['t4,task']},
|
||||
't4,task': {'action': 'std.noop',
|
||||
'on-success': ['t5+task']},
|
||||
't5+task': {'action': 'std.noop',
|
||||
'on-success': ['t6$task']},
|
||||
't6$task': {'action': 'std.noop',
|
||||
'on-success': ['t7%task']},
|
||||
't7%task': {'action': 'std.noop',
|
||||
'on-success': ['t8^task']},
|
||||
't8^task': {'action': 'std.noop',
|
||||
}}}}
|
||||
|
||||
dsl_yaml = yaml.safe_dump(wf, default_flow_style=False)
|
||||
|
||||
self._spec_parser(dsl_yaml)
|
||||
|
||||
def test_tags(self):
|
||||
tests = [
|
||||
({'tags': ''}, True),
|
||||
|
Loading…
x
Reference in New Issue
Block a user