Move test_update_group_replace() to functional tests

Part of blueprint decouple-nested
Change-Id: I7a96f5ede436e1aecac5447fef9d8ee6c5fb13a8
This commit is contained in:
Angus Salkeld
2014-12-15 11:27:04 +10:00
parent 9d18ea84b5
commit 7aedc6a822
2 changed files with 32 additions and 28 deletions

View File

@@ -185,34 +185,6 @@ class InstanceGroupTest(common.HeatTestCase):
self.m.VerifyAll()
def test_update_group_replace(self):
"""Make sure that during a group update the non updatable
properties cause a replacement.
"""
t = template_format.parse(ig_template)
properties = t['Resources']['JobServerGroup']['Properties']
properties['Size'] = '2'
stack = utils.parse_stack(t)
self._stub_create(2)
self.m.ReplayAll()
self.create_resource(t, stack, 'JobServerConfig')
rsrc = self.create_resource(t, stack, 'JobServerGroup')
self.m.ReplayAll()
props = copy.copy(rsrc.properties.data)
props['AvailabilityZones'] = ['wibble']
update_snippet = rsrc_defn.ResourceDefinition(rsrc.name,
rsrc.type(),
props)
updater = scheduler.TaskRunner(rsrc.update, update_snippet)
self.assertRaises(resource.UpdateReplace, updater)
rsrc.delete()
self.m.VerifyAll()
class TestInstanceGroup(common.HeatTestCase):
def setUp(self):

View File

@@ -170,3 +170,35 @@ outputs:
self._wait_for_stack_status(stack_identifier, 'UPDATE_COMPLETE')
stack = self.client.stacks.get(stack_identifier)
self.assert_instance_count(stack, 5)
def test_update_group_replace(self):
"""Make sure that during a group update the non updatable
properties cause a replacement.
"""
files = {'provider.yaml': self.instance_template}
env = {'resource_registry':
{'AWS::EC2::Instance': 'provider.yaml'},
'parameters': {'size': 1,
'image': self.conf.image_ref,
'keyname': self.conf.keypair_name,
'flavor': self.conf.instance_type}}
stack_identifier = self.stack_create(template=self.template,
files=files,
environment=env)
rsrc = self.client.resources.get(stack_identifier, 'JobServerGroup')
orig_asg_id = rsrc.physical_resource_id
env2 = {'resource_registry':
{'AWS::EC2::Instance': 'provider.yaml'},
'parameters': {'size': '2',
'AZ': 'wibble',
'image': self.conf.image_ref,
'keyname': self.conf.keypair_name,
'flavor': self.conf.instance_type}}
self.update_stack(stack_identifier, self.template,
environment=env2, files=files)
# replacement will cause the resource physical_resource_id to change.
rsrc = self.client.resources.get(stack_identifier, 'JobServerGroup')
self.assertNotEqual(orig_asg_id, rsrc.physical_resource_id)