summaryrefslogtreecommitdiff
path: root/heat_integrationtests
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2018-09-05 19:25:52 -0400
committerZane Bitter <zbitter@redhat.com>2019-01-29 16:47:33 +1300
commit97df8bb6ca82b2a225226340b118a93bf1cf1120 (patch)
treef6ff513068fe076af9ae62f69f4ff3b43c3501a5 /heat_integrationtests
parente34da892901dbba709d3854f8979eee32594d916 (diff)
downloadheat-97df8bb6ca82b2a225226340b118a93bf1cf1120.tar.gz
Improve best existing resource selection
Rank all existing versions of a resource in a convergence stack to improve the likelihood that we find the best one to update. This allows us to roll back to the original version of a resource (or even attempt an in-place update of it) when replacing it has failed. Previously this only worked during automatic rollback; on subsequent updates we would always work on the failed replacement (which inevitably meant attempting another replacement in almost all cases). Change-Id: Ia231fae85d1ddb9fc7b7de4e82cec0c0e0fd06b7 Story: #2003579 Task: 24881
Diffstat (limited to 'heat_integrationtests')
-rw-r--r--heat_integrationtests/functional/test_create_update.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/heat_integrationtests/functional/test_create_update.py b/heat_integrationtests/functional/test_create_update.py
index b5793685f..a84dcde0e 100644
--- a/heat_integrationtests/functional/test_create_update.py
+++ b/heat_integrationtests/functional/test_create_update.py
@@ -68,9 +68,8 @@ def _change_rsrc_properties(template, rsrcs, values):
for rsrc_name in rsrcs:
rsrc_prop = modified_template['resources'][
rsrc_name]['properties']
- for prop in rsrc_prop:
- if prop in values:
- rsrc_prop[prop] = values[prop]
+ for prop, new_val in values.items():
+ rsrc_prop[prop] = new_val
return modified_template
@@ -280,6 +279,31 @@ resources:
self.assertEqual(updated_resources,
self.list_resources(stack_identifier))
+ @test.requires_convergence
+ def test_stack_update_replace_manual_rollback(self):
+ template = _change_rsrc_properties(test_template_one_resource,
+ ['test1'],
+ {'update_replace_value': '1'})
+ stack_identifier = self.stack_create(template=template)
+ original_resource_id = self.get_physical_resource_id(stack_identifier,
+ 'test1')
+
+ tmpl_update = _change_rsrc_properties(test_template_one_resource,
+ ['test1'],
+ {'update_replace_value': '2',
+ 'fail': True})
+ # Update with bad template, we should fail
+ self.update_stack(stack_identifier, tmpl_update,
+ expected_status='UPDATE_FAILED',
+ disable_rollback=True)
+ # Manually roll back to previous template
+ self.update_stack(stack_identifier, template)
+ final_resource_id = self.get_physical_resource_id(stack_identifier,
+ 'test1')
+ # Original resource was good, and replacement was never created, so it
+ # should be kept.
+ self.assertEqual(original_resource_id, final_resource_id)
+
def test_stack_update_provider(self):
template = _change_rsrc_properties(
test_template_one_resource, ['test1'],