Fix outputs validation place in Stack.validate

Because of outputs validation check located in
wrong place, outputs validation skipped, when
template has no resources. It's incorrect because
of possible incorrect references to unknown resources.

Change-Id: I693b51540b0678aa17b861b9f85a0cb2a9552660
Closes-bug: #1396441
This commit is contained in:
Peter Razumovsky 2014-11-27 11:52:58 +03:00
parent 1812a70a9b
commit 514916125b
2 changed files with 50 additions and 15 deletions

View File

@ -4264,6 +4264,41 @@ class StackTest(common.HeatTestCase):
'(AResource Bar) is incorrect.',
six.text_type(ex))
def test_incorrect_outputs_cfn_incorrect_reference(self):
tmpl = template_format.parse("""
HeatTemplateFormatVersion: '2012-12-12'
Outputs:
Output:
Value:
Fn::GetAtt:
- Resource
- Foo
""")
self.stack = parser.Stack(self.ctx, 'stack_with_incorrect_outputs',
template.Template(tmpl))
ex = self.assertRaises(exception.StackValidationFailed,
self.stack.validate)
self.assertIn('The specified reference "Resource" '
'(in unknown) is incorrect.', six.text_type(ex))
def test_incorrect_outputs_incorrect_reference(self):
tmpl = template_format.parse("""
heat_template_version: 2013-05-23
outputs:
output:
value: { get_attr: [resource, foo] }
""")
self.stack = parser.Stack(self.ctx, 'stack_with_incorrect_outputs',
template.Template(tmpl))
ex = self.assertRaises(exception.StackValidationFailed,
self.stack.validate)
self.assertIn('The specified reference "resource" '
'(in unknown) is incorrect.', six.text_type(ex))
def test_incorrect_outputs_cfn_empty_output(self):
tmpl = template_format.parse("""
HeatTemplateFormatVersion: '2012-12-12'