Tags in workflows were not being properly checked

If an invalid tag section was specified, Mistral would throw a 500,
with no useful error message. This makes the tags get checked and
throws a proper error if so.

Change-Id: If2ae69ef76a857bcafe1e4b3d72956c6deeeea09
Closes-Bug: #1747950
This commit is contained in:
Brad P. Crochet 2018-02-07 13:33:59 -05:00
parent 7da5b880c9
commit 7c807d3d82
2 changed files with 21 additions and 1 deletions

View File

@ -38,7 +38,8 @@ class WorkflowSpec(base.BaseSpec):
"input": types.UNIQUE_STRING_OR_ONE_KEY_DICT_LIST,
"output": types.NONEMPTY_DICT,
"output-on-error": types.NONEMPTY_DICT,
"vars": types.NONEMPTY_DICT
"vars": types.NONEMPTY_DICT,
"tags": types.UNIQUE_STRING_LIST
},
"required": ["tasks"],
"additionalProperties": False

View File

@ -425,3 +425,22 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase):
"Workflow name cannot be in the format of UUID",
str(exception)
)
def test_tags(self):
tests = [
({'tags': ''}, True),
({'tags': []}, True),
({'tags': ['']}, True),
({'tags': ['tag']}, False),
({'tags': ['tag', 'tag']}, True),
({'tags': None}, True)
]
for wf_tags, expect_error in tests:
overlay = {'test': wf_tags}
self._parse_dsl_spec(
add_tasks=True,
changes=overlay,
expect_error=expect_error
)