Merge "Tags in workflows were not being properly checked"

This commit is contained in:
Zuul 2018-02-09 14:51:58 +00:00 committed by Gerrit Code Review
commit 82d5d10f89
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
)