Add missing schema validation and unit tests for 'publish-on-error'
Change-Id: I87719d9ed9af7560fdff7af9215d99a686c4d8df
This commit is contained in:
parent
fbe2b3289a
commit
f7e04b3ef9
@ -128,6 +128,7 @@ class TaskSpec(base.BaseSpec):
|
|||||||
|
|
||||||
self.validate_expr(self._data.get('input', {}))
|
self.validate_expr(self._data.get('input', {}))
|
||||||
self.validate_expr(self._data.get('publish', {}))
|
self.validate_expr(self._data.get('publish', {}))
|
||||||
|
self.validate_expr(self._data.get('publish-on-error', {}))
|
||||||
self.validate_expr(self._data.get('keep-result', {}))
|
self.validate_expr(self._data.get('keep-result', {}))
|
||||||
self.validate_expr(self._data.get('safe-rerun', {}))
|
self.validate_expr(self._data.get('safe-rerun', {}))
|
||||||
|
|
||||||
|
@ -166,6 +166,31 @@ class TaskSpecValidation(v2_base.WorkflowSpecValidationTestCase):
|
|||||||
expect_error=expect_error
|
expect_error=expect_error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_publish_on_error(self):
|
||||||
|
tests = [
|
||||||
|
({'publish-on-error': ''}, True),
|
||||||
|
({'publish-on-error': {}}, True),
|
||||||
|
({'publish-on-error': None}, True),
|
||||||
|
({'publish-on-error': {'k1': 'v1'}}, False),
|
||||||
|
({'publish-on-error': {'k1': '<% $.v1 %>'}}, False),
|
||||||
|
({'publish-on-error': {'k1': '<% 1 + 2 %>'}}, False),
|
||||||
|
({'publish-on-error': {'k1': '<% * %>'}}, True),
|
||||||
|
({'publish-on-error': {'k1': '{{ _.v1 }}'}}, False),
|
||||||
|
({'publish-on-error': {'k1': '{{ 1 + 2 }}'}}, False),
|
||||||
|
({'publish-on-error': {'k1': '{{ * }}'}}, True)
|
||||||
|
]
|
||||||
|
|
||||||
|
for output, expect_error in tests:
|
||||||
|
overlay = {'test': {'tasks': {'task1': {'action': 'test.mock'}}}}
|
||||||
|
|
||||||
|
utils.merge_dicts(overlay['test']['tasks']['task1'], output)
|
||||||
|
|
||||||
|
self._parse_dsl_spec(
|
||||||
|
add_tasks=False,
|
||||||
|
changes=overlay,
|
||||||
|
expect_error=expect_error
|
||||||
|
)
|
||||||
|
|
||||||
def test_policies(self):
|
def test_policies(self):
|
||||||
tests = [
|
tests = [
|
||||||
({'retry': {'count': 3, 'delay': 1}}, False),
|
({'retry': {'count': 3, 'delay': 1}}, False),
|
||||||
|
Loading…
Reference in New Issue
Block a user