diff options
author | Zuul <zuul@review.opendev.org> | 2019-10-14 07:53:02 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-10-14 07:53:02 +0000 |
commit | 89ab96176fb7a0a25e7839ac21027640e9c5aaaf (patch) | |
tree | dcbaa5f5aeeb49614b0ea8e705a2e23866717d6a /heat_integrationtests | |
parent | 491e2fb47011a55e06908a417534ca51b4b057ef (diff) | |
parent | d539fdcb2edd6930f2392cd60f019e2d87b4c81a (diff) | |
download | heat-89ab96176fb7a0a25e7839ac21027640e9c5aaaf.tar.gz |
Merge "Add regression tests for conditional outputs in nested stacks"
Diffstat (limited to 'heat_integrationtests')
-rw-r--r-- | heat_integrationtests/functional/test_conditions.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/heat_integrationtests/functional/test_conditions.py b/heat_integrationtests/functional/test_conditions.py index 9feb7cd2c..84886ceb3 100644 --- a/heat_integrationtests/functional/test_conditions.py +++ b/heat_integrationtests/functional/test_conditions.py @@ -619,3 +619,64 @@ class CreateUpdateResConditionTest(functional_base.FunctionalTestsBase): self.update_stack(stack_identifier, template=fail_rename_tmpl, expected_status='UPDATE_FAILED') self.update_stack(stack_identifier, template=recover_rename_tmpl) + + +root_output_tmpl = ''' +heat_template_version: 2016-10-14 +parameters: + env_type: + type: string + default: test +conditions: + cd1: {equals : [{get_param: env_type}, "prod"]} +resources: + nested: + type: nested_output.yaml + properties: + env_type: {get_param: env_type} +outputs: + standard: + value: {get_attr: [nested, standard]} + cond: + value: {get_attr: [nested, cond]} + condition: cd1 + cond_value: + value: {get_attr: [nested, cond_value]} +''' + +nested_output_tmpl = ''' +heat_template_version: 2016-10-14 +parameters: + env_type: + type: string +conditions: + cd1: {equals : [{get_param: env_type}, "prod"]} +outputs: + standard: + value: hello + cond: + value: world + condition: cd1 + cond_value: + value: {if: [cd1, 'prod', 'test']} +''' + + +class CreateNestedOutputConditionTest(functional_base.FunctionalTestsBase): + + def test_condition_nested_outputs(self): + stack_identifier = self.stack_create(template=root_output_tmpl, + files={'nested_output.yaml': + nested_output_tmpl}) + + standard = self.client.stacks.output_show(stack_identifier, + 'standard')['output'] + self.assertEqual('hello', standard['output_value']) + + cond = self.client.stacks.output_show(stack_identifier, + 'cond')['output'] + self.assertIsNone(cond['output_value']) + + cond_val = self.client.stacks.output_show(stack_identifier, + 'cond_value')['output'] + self.assertEqual('test', cond_val['output_value']) |