diff --git a/heat/tests/aws/test_eip.py b/heat/tests/aws/test_eip.py index 5989802f6..2943e82f4 100644 --- a/heat/tests/aws/test_eip.py +++ b/heat/tests/aws/test_eip.py @@ -27,6 +27,7 @@ from heat.engine.resources.aws.ec2 import eip from heat.engine import rsrc_defn from heat.engine import scheduler from heat.engine import stack as parser +from heat.engine import stk_defn from heat.engine import template as tmpl from heat.tests import common from heat.tests.openstack.nova import fakes as fakes_nova @@ -228,6 +229,8 @@ class EIPTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) scheduler.TaskRunner(rsrc.create)() self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state) + stk_defn.update_resource_data(stack.defn, resource_name, + rsrc.node_data()) return rsrc def create_association(self, t, stack, resource_name): @@ -238,6 +241,8 @@ class EIPTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) scheduler.TaskRunner(rsrc.create)() self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state) + stk_defn.update_resource_data(stack.defn, resource_name, + rsrc.node_data()) return rsrc def _mock_server_get(self, server='WebServer', mock_server=None, @@ -482,6 +487,8 @@ class AllocTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) scheduler.TaskRunner(rsrc.create)() self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state) + stk_defn.update_resource_data(stack.defn, resource_name, + rsrc.node_data()) return rsrc def create_association(self, t, stack, resource_name): @@ -492,6 +499,8 @@ class AllocTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) scheduler.TaskRunner(rsrc.create)() self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state) + stk_defn.update_resource_data(stack.defn, resource_name, + rsrc.node_data()) return rsrc def mock_update_floatingip(self, port='the_nic'): @@ -833,6 +842,7 @@ class AllocTest(common.HeatTestCase): props)) scheduler.TaskRunner(ass.update, update_snippet)() self.assertEqual((ass.UPDATE, ass.COMPLETE), ass.state) + stk_defn.update_resource_data(stack.defn, ass.name, ass.node_data()) # change AllocationId to EIP props = copy.deepcopy(ass.properties.data) diff --git a/heat/tests/aws/test_user.py b/heat/tests/aws/test_user.py index 4cb15b76a..63102a53d 100644 --- a/heat/tests/aws/test_user.py +++ b/heat/tests/aws/test_user.py @@ -21,6 +21,7 @@ from heat.engine import node_data from heat.engine.resources.aws.iam import user from heat.engine.resources.openstack.heat import access_policy as ap from heat.engine import scheduler +from heat.engine import stk_defn from heat.objects import resource_data as resource_data_object from heat.tests import common from heat.tests import fakes @@ -316,6 +317,8 @@ class AccessKeyTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) scheduler.TaskRunner(rsrc.create)() self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state) + stk_defn.update_resource_data(stack.defn, resource_name, + rsrc.node_data()) return rsrc def create_access_key(self, t, stack, resource_name): diff --git a/heat/tests/aws/test_waitcondition.py b/heat/tests/aws/test_waitcondition.py index cc9326a9e..ba3f68a0c 100644 --- a/heat/tests/aws/test_waitcondition.py +++ b/heat/tests/aws/test_waitcondition.py @@ -30,6 +30,7 @@ from heat.engine.resources.aws.cfn import wait_condition_handle as aws_wch from heat.engine import rsrc_defn from heat.engine import scheduler from heat.engine import stack as parser +from heat.engine import stk_defn from heat.engine import template as tmpl from heat.objects import resource as resource_objects from heat.tests import common @@ -641,6 +642,8 @@ class WaitConditionUpdateTest(common.HeatTestCase): rsrc.type(), uprops) + stk_defn.update_resource_data(self.stack.defn, 'WaitHandle', + self.stack['WaitHandle'].node_data()) updater = scheduler.TaskRunner(rsrc.update, update_snippet) updater() diff --git a/heat/tests/openstack/cinder/test_volume_utils.py b/heat/tests/openstack/cinder/test_volume_utils.py index a5734a554..a3726e2af 100644 --- a/heat/tests/openstack/cinder/test_volume_utils.py +++ b/heat/tests/openstack/cinder/test_volume_utils.py @@ -20,6 +20,7 @@ from heat.engine.clients.os import nova from heat.engine.resources.aws.ec2 import volume as aws_vol from heat.engine.resources.openstack.cinder import volume as os_vol from heat.engine import scheduler +from heat.engine import stk_defn from heat.tests import common from heat.tests.openstack.nova import fakes as fakes_nova @@ -84,6 +85,8 @@ class BaseVolumeTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) scheduler.TaskRunner(rsrc.create)() self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state) + stk_defn.update_resource_data(stack.defn, resource_name, + rsrc.node_data()) return rsrc def create_attachment(self, t, stack, resource_name): @@ -98,6 +101,8 @@ class BaseVolumeTest(common.HeatTestCase): self.assertIsNone(rsrc.validate()) scheduler.TaskRunner(rsrc.create)() self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state) + stk_defn.update_resource_data(stack.defn, resource_name, + rsrc.node_data()) return rsrc diff --git a/heat/tests/openstack/neutron/test_neutron_floating_ip.py b/heat/tests/openstack/neutron/test_neutron_floating_ip.py index 589d19f2d..72e57596d 100644 --- a/heat/tests/openstack/neutron/test_neutron_floating_ip.py +++ b/heat/tests/openstack/neutron/test_neutron_floating_ip.py @@ -28,6 +28,7 @@ from heat.engine import node_data from heat.engine import rsrc_defn from heat.engine import scheduler from heat.engine import stack as parser +from heat.engine import stk_defn from heat.engine import template as tmpl from heat.tests import common from heat.tests import utils @@ -427,14 +428,17 @@ class NeutronFloatingIPTest(common.HeatTestCase): fip = stack['floating_ip'] scheduler.TaskRunner(fip.create)() self.assertEqual((fip.CREATE, fip.COMPLETE), fip.state) + stk_defn.update_resource_data(stack.defn, fip.name, fip.node_data()) p = stack['port_floating'] scheduler.TaskRunner(p.create)() self.assertEqual((p.CREATE, p.COMPLETE), p.state) + stk_defn.update_resource_data(stack.defn, p.name, p.node_data()) fipa = stack['floating_ip_assoc'] scheduler.TaskRunner(fipa.create)() self.assertEqual((fipa.CREATE, fipa.COMPLETE), fipa.state) + stk_defn.update_resource_data(stack.defn, fipa.name, fipa.node_data()) self.assertIsNotNone(fipa.id) self.assertEqual(fipa.id, fipa.resource_id) @@ -692,10 +696,12 @@ class NeutronFloatingIPTest(common.HeatTestCase): p = stack['port_floating'] scheduler.TaskRunner(p.create)() self.assertEqual((p.CREATE, p.COMPLETE), p.state) + stk_defn.update_resource_data(stack.defn, p.name, p.node_data()) fip = stack['floating_ip'] scheduler.TaskRunner(fip.create)() self.assertEqual((fip.CREATE, fip.COMPLETE), fip.state) + stk_defn.update_resource_data(stack.defn, fip.name, fip.node_data()) # test update FloatingIp with port_id props = copy.deepcopy(fip.properties.data) @@ -706,6 +712,7 @@ class NeutronFloatingIPTest(common.HeatTestCase): props)) scheduler.TaskRunner(fip.update, update_snippet)() self.assertEqual((fip.UPDATE, fip.COMPLETE), fip.state) + stk_defn.update_resource_data(stack.defn, fip.name, fip.node_data()) # test update FloatingIp with None port_id props = copy.deepcopy(fip.properties.data) diff --git a/heat/tests/openstack/neutron/test_neutron_trunk.py b/heat/tests/openstack/neutron/test_neutron_trunk.py index ea878d63f..6f1dfa78f 100644 --- a/heat/tests/openstack/neutron/test_neutron_trunk.py +++ b/heat/tests/openstack/neutron/test_neutron_trunk.py @@ -22,6 +22,7 @@ from heat.common import template_format from heat.engine.clients.os import neutron from heat.engine.resources.openstack.neutron import trunk from heat.engine import scheduler +from heat.engine import stk_defn from heat.tests import common from heat.tests import utils from neutronclient.common import exceptions as ncex @@ -121,6 +122,8 @@ class NeutronTrunkTest(common.HeatTestCase): def _create_trunk(self, stack): trunk = stack['trunk'] scheduler.TaskRunner(trunk.create)() + stk_defn.update_resource_data(stack.defn, trunk.name, + trunk.node_data()) self.assertEqual((trunk.CREATE, trunk.COMPLETE), trunk.state) @@ -146,9 +149,12 @@ class NeutronTrunkTest(common.HeatTestCase): del t['resources']['subport_2'] stack = utils.parse_stack(t) - self.patchobject( - stack['parent_port'], 'FnGetRefId', return_value='parent port id') + parent_port = stack['parent_port'] + self.patchobject(parent_port, 'get_reference_id', + return_value='parent port id') self.find_resource_mock.return_value = 'parent port id' + stk_defn.update_resource_data(stack.defn, parent_port.name, + parent_port.node_data()) self._create_trunk(stack) @@ -166,10 +172,17 @@ class NeutronTrunkTest(common.HeatTestCase): del t['resources']['subport_2'] stack = utils.parse_stack(t) - self.patchobject( - stack['parent_port'], 'FnGetRefId', return_value='parent port id') - self.patchobject( - stack['subport_1'], 'FnGetRefId', return_value='subport id') + parent_port = stack['parent_port'] + self.patchobject(parent_port, 'get_reference_id', + return_value='parent port id') + stk_defn.update_resource_data(stack.defn, parent_port.name, + parent_port.node_data()) + + subport_1 = stack['subport_1'] + self.patchobject(subport_1, 'get_reference_id', + return_value='subport id') + stk_defn.update_resource_data(stack.defn, subport_1.name, + subport_1.node_data()) self._create_trunk(stack) @@ -191,12 +204,23 @@ class NeutronTrunkTest(common.HeatTestCase): del t['resources']['trunk']['properties']['sub_ports'][2:] stack = utils.parse_stack(t) - self.patchobject( - stack['parent_port'], 'FnGetRefId', return_value='parent_port_id') - self.patchobject( - stack['subport_1'], 'FnGetRefId', return_value='subport_1_id') - self.patchobject( - stack['subport_2'], 'FnGetRefId', return_value='subport_2_id') + parent_port = stack['parent_port'] + self.patchobject(parent_port, 'get_reference_id', + return_value='parent_port_id') + stk_defn.update_resource_data(stack.defn, parent_port.name, + parent_port.node_data()) + + subport_1 = stack['subport_1'] + self.patchobject(subport_1, 'get_reference_id', + return_value='subport_1_id') + stk_defn.update_resource_data(stack.defn, subport_1.name, + subport_1.node_data()) + + subport_2 = stack['subport_2'] + self.patchobject(subport_2, 'get_reference_id', + return_value='subport_2_id') + stk_defn.update_resource_data(stack.defn, subport_2.name, + subport_2.node_data()) self._create_trunk(stack) @@ -248,8 +272,11 @@ class NeutronTrunkTest(common.HeatTestCase): del t['resources']['trunk']['properties']['sub_ports'] stack = utils.parse_stack(t) - self.patchobject( - stack['parent_port'], 'FnGetRefId', return_value='parent port id') + parent_port = stack['parent_port'] + self.patchobject(parent_port, 'get_reference_id', + return_value='parent port id') + stk_defn.update_resource_data(stack.defn, parent_port.name, + parent_port.node_data()) def find_resourceid_by_name_or_id( _client, _resource, name_or_id, **_kwargs): @@ -280,10 +307,17 @@ class NeutronTrunkTest(common.HeatTestCase): 'properties']['sub_ports'][0]['port'] = 'subport name' stack = utils.parse_stack(t) - self.patchobject( - stack['parent_port'], 'FnGetRefId', return_value='parent port id') - self.patchobject( - stack['subport_1'], 'FnGetRefId', return_value='subport id') + parent_port = stack['parent_port'] + self.patchobject(parent_port, 'get_reference_id', + return_value='parent port id') + stk_defn.update_resource_data(stack.defn, parent_port.name, + parent_port.node_data()) + + subport_1 = stack['subport_1'] + self.patchobject(subport_1, 'get_reference_id', + return_value='subport id') + stk_defn.update_resource_data(stack.defn, subport_1.name, + subport_1.node_data()) def find_resourceid_by_name_or_id( _client, _resource, name_or_id, **_kwargs): diff --git a/heat/tests/test_stack.py b/heat/tests/test_stack.py index fe6dc4008..3bb91b5ca 100644 --- a/heat/tests/test_stack.py +++ b/heat/tests/test_stack.py @@ -39,6 +39,7 @@ from heat.engine import resource from heat.engine import scheduler from heat.engine import service from heat.engine import stack +from heat.engine import stk_defn from heat.engine import template from heat.engine import update from heat.objects import raw_template as raw_template_object @@ -1099,9 +1100,13 @@ class StackTest(common.HeatTestCase): (rsrc.UPDATE, rsrc.COMPLETE), (rsrc.CHECK, rsrc.COMPLETE)): rsrc.state_set(action, status) + stk_defn.update_resource_data(self.stack.defn, rsrc.name, + rsrc.node_data()) self.assertEqual(rsrc, self.stack.resource_by_refid('aaaa')) rsrc.state_set(rsrc.DELETE, rsrc.IN_PROGRESS) + stk_defn.update_resource_data(self.stack.defn, rsrc.name, + rsrc.node_data()) try: self.assertIsNone(self.stack.resource_by_refid('aaaa')) self.assertIsNone(self.stack.resource_by_refid('bbbb'))