Merge "Scan for output errors in functional tests"
This commit is contained in:
commit
fee82d5aa8
@ -175,10 +175,18 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
||||
return net
|
||||
|
||||
@staticmethod
|
||||
def _stack_output(stack, output_key):
|
||||
def _stack_output(stack, output_key, validate_errors=True):
|
||||
"""Return a stack output value for a given key."""
|
||||
return next((o['output_value'] for o in stack.outputs
|
||||
if o['output_key'] == output_key), None)
|
||||
value = None
|
||||
for o in stack.outputs:
|
||||
if validate_errors and 'output_error' in o:
|
||||
# scan for errors in the stack output.
|
||||
raise ValueError(
|
||||
'Unexpected output errors in %s : %s' % (
|
||||
output_key, o['output_error']))
|
||||
if o['output_key'] == output_key:
|
||||
value = o['output_value']
|
||||
return value
|
||||
|
||||
def _ping_ip_address(self, ip_address, should_succeed=True):
|
||||
cmd = ['ping', '-c1', '-w1', ip_address]
|
||||
|
@ -244,14 +244,14 @@ resources:
|
||||
|
||||
env = {'resource_registry':
|
||||
{'My::RandomString': 'OS::Heat::RandomString'}}
|
||||
template_one = self.template.replace("count: 0", "count: 1")
|
||||
template_one = self.template.replace("count: 0", "count: 2")
|
||||
stack_identifier = self.stack_create(template=template_one,
|
||||
environment=env)
|
||||
self.assertEqual({u'random_group': u'OS::Heat::ResourceGroup'},
|
||||
self.list_resources(stack_identifier))
|
||||
|
||||
initial_nested_ident = self._group_nested_identifier(stack_identifier)
|
||||
self.assertEqual({'0': 'My::RandomString'},
|
||||
self.assertEqual({'0': 'My::RandomString', '1': 'My::RandomString'},
|
||||
self.list_resources(initial_nested_ident))
|
||||
# get the output
|
||||
stack0 = self.client.stacks.get(stack_identifier)
|
||||
@ -301,7 +301,7 @@ outputs:
|
||||
env = {'resource_registry':
|
||||
{'My::RandomString': 'my_random.yaml'}}
|
||||
|
||||
template_one = self.template.replace("count: 0", "count: 1")
|
||||
template_one = self.template.replace("count: 0", "count: 2")
|
||||
stack_identifier = self.stack_create(template=template_one,
|
||||
environment=env,
|
||||
files=files1)
|
||||
@ -309,7 +309,7 @@ outputs:
|
||||
self.list_resources(stack_identifier))
|
||||
|
||||
initial_nested_ident = self._group_nested_identifier(stack_identifier)
|
||||
self.assertEqual({'0': 'My::RandomString'},
|
||||
self.assertEqual({'0': 'My::RandomString', '1': 'My::RandomString'},
|
||||
self.list_resources(initial_nested_ident))
|
||||
# get the output
|
||||
stack0 = self.client.stacks.get(stack_identifier)
|
||||
|
@ -180,6 +180,9 @@ heat_template_version: 2014-10-16
|
||||
resources:
|
||||
secret1:
|
||||
type: OS::Heat::RandomString
|
||||
outputs:
|
||||
nested_str:
|
||||
value: {get_attr: [secret1, value]}
|
||||
'''
|
||||
stack_identifier = self.stack_create(
|
||||
template=self.main_templ,
|
||||
|
Loading…
Reference in New Issue
Block a user