Merge "Add function tests for event sinks"
diff --git a/common/test.py b/common/test.py
index c54febe..f6889ab 100644
--- a/common/test.py
+++ b/common/test.py
@@ -310,7 +310,8 @@
while timeutils.delta_seconds(start,
timeutils.utcnow()) < build_timeout:
try:
- stack = self.client.stacks.get(stack_identifier)
+ stack = self.client.stacks.get(stack_identifier,
+ resolve_outputs=False)
except heat_exceptions.HTTPNotFound:
if success_on_not_found:
return
@@ -367,7 +368,7 @@
stack_name = stack_identifier.split('/')[0]
self.updated_time[stack_identifier] = self.client.stacks.get(
- stack_identifier).updated_time
+ stack_identifier, resolve_outputs=False).updated_time
self._handle_in_progress(
self.client.stacks.update,
@@ -439,7 +440,7 @@
nested_identifier = '/'.join(nested_href.split('/')[-2:])
self.assertEqual(rsrc.physical_resource_id, nested_id)
- nested_stack = self.client.stacks.get(nested_id)
+ nested_stack = self.client.stacks.get(nested_id, resolve_outputs=False)
nested_identifier2 = '%s/%s' % (nested_stack.stack_name,
nested_stack.id)
self.assertEqual(nested_identifier, nested_identifier2)
@@ -453,7 +454,8 @@
rsrc = self.client.resources.get(stack_identifier, group_name)
physical_resource_id = rsrc.physical_resource_id
- nested_stack = self.client.stacks.get(physical_resource_id)
+ nested_stack = self.client.stacks.get(physical_resource_id,
+ resolve_outputs=False)
nested_identifier = '%s/%s' % (nested_stack.stack_name,
nested_stack.id)
parent_id = stack_identifier.split("/")[-1]
@@ -495,7 +497,7 @@
if expected_status not in ['ROLLBACK_COMPLETE'] and enable_cleanup:
self.addCleanup(self._stack_delete, name)
- stack = self.client.stacks.get(name)
+ stack = self.client.stacks.get(name, resolve_outputs=False)
stack_identifier = '%s/%s' % (name, stack.id)
kwargs = {'stack_identifier': stack_identifier,
'status': expected_status}
@@ -526,8 +528,7 @@
adopt_stack_data=adopt_data,
)
self.addCleanup(self._stack_delete, name)
-
- stack = self.client.stacks.get(name)
+ stack = self.client.stacks.get(name, resolve_outputs=False)
stack_identifier = '%s/%s' % (name, stack.id)
self._wait_for_stack_status(stack_identifier, wait_for_status)
return stack_identifier
diff --git a/functional/test_default_parameters.py b/functional/test_default_parameters.py
index a33823f..7201969 100644
--- a/functional/test_default_parameters.py
+++ b/functional/test_default_parameters.py
@@ -77,7 +77,7 @@
# remove the default from the parameter in the nested template.
ntempl = yaml.safe_load(self.nested_template)
del ntempl['parameters']['length']['default']
- nested_template = yaml.dump(ntempl)
+ nested_template = yaml.safe_dump(ntempl)
else:
nested_template = self.nested_template
diff --git a/functional/test_hooks.py b/functional/test_hooks.py
index d9ebd44..bafb0ef 100644
--- a/functional/test_hooks.py
+++ b/functional/test_hooks.py
@@ -191,7 +191,7 @@
res_after.physical_resource_id)
def test_hook_pre_create_nested(self):
- files = {'nested.yaml': yaml.dump(self.template)}
+ files = {'nested.yaml': yaml.safe_dump(self.template)}
env = {'resource_registry':
{'resources':
{'nested':
diff --git a/functional/test_template_resource.py b/functional/test_template_resource.py
index fa34e2e..9a3e833 100644
--- a/functional/test_template_resource.py
+++ b/functional/test_template_resource.py
@@ -848,3 +848,90 @@
exp = ('ERROR: Attribute here-it-is for facade '
'OS::Thingy missing in provider')
self.assertEqual(exp, six.text_type(exc))
+
+
+class TemplateResourceNewParamTest(functional_base.FunctionalTestsBase):
+
+ main_template = '''
+heat_template_version: 2013-05-23
+resources:
+ my_resource:
+ type: resource.yaml
+ properties:
+ value1: foo
+'''
+ nested_templ = '''
+heat_template_version: 2013-05-23
+parameters:
+ value1:
+ type: string
+resources:
+ test:
+ type: OS::Heat::TestResource
+ properties:
+ value: {get_param: value1}
+'''
+ main_template_update = '''
+heat_template_version: 2013-05-23
+resources:
+ my_resource:
+ type: resource.yaml
+ properties:
+ value1: foo
+ value2: foo
+'''
+ nested_templ_update_fail = '''
+heat_template_version: 2013-05-23
+parameters:
+ value1:
+ type: string
+ value2:
+ type: string
+resources:
+ test:
+ type: OS::Heat::TestResource
+ properties:
+ fail: True
+ value:
+ str_replace:
+ template: VAL1-VAL2
+ params:
+ VAL1: {get_param: value1}
+ VAL2: {get_param: value2}
+'''
+ nested_templ_update = '''
+heat_template_version: 2013-05-23
+parameters:
+ value1:
+ type: string
+ value2:
+ type: string
+resources:
+ test:
+ type: OS::Heat::TestResource
+ properties:
+ value:
+ str_replace:
+ template: VAL1-VAL2
+ params:
+ VAL1: {get_param: value1}
+ VAL2: {get_param: value2}
+'''
+
+ def test_update(self):
+ stack_identifier = self.stack_create(
+ template=self.main_template,
+ files={'resource.yaml': self.nested_templ})
+
+ # Make the update fails with the new parameter inserted.
+ self.update_stack(
+ stack_identifier,
+ self.main_template_update,
+ files={'resource.yaml': self.nested_templ_update_fail},
+ expected_status='UPDATE_FAILED')
+
+ # Fix the update, it should succeed now.
+ self.update_stack(
+ stack_identifier,
+ self.main_template_update,
+ files={'resource.yaml': self.nested_templ_update})