diff --git a/heat_integrationtests/common/test.py b/heat_integrationtests/common/test.py index 2c09dcb7ae..7b17d57f26 100644 --- a/heat_integrationtests/common/test.py +++ b/heat_integrationtests/common/test.py @@ -179,9 +179,10 @@ class HeatIntegrationTest(testscenarios.WithScenarios, LOG.debug('Console output for %s', server.id) LOG.debug(server.get_console_output()) - def _load_template(self, base_file, file_name): + def _load_template(self, base_file, file_name, sub_dir=None): + sub_dir = sub_dir or '' filepath = os.path.join(os.path.dirname(os.path.realpath(base_file)), - file_name) + sub_dir, file_name) with open(filepath) as f: return f.read() diff --git a/heat_integrationtests/scenario/templates/test_neutron_autoscaling.yaml b/heat_integrationtests/scenario/templates/test_neutron_autoscaling.yaml new file mode 100644 index 0000000000..59aad2c981 --- /dev/null +++ b/heat_integrationtests/scenario/templates/test_neutron_autoscaling.yaml @@ -0,0 +1,55 @@ +heat_template_version: 2014-10-16 + +description: Auto-scaling Test + +parameters: + image_id: + type: string + label: Image ID + description: Image ID from configurations + capacity: + type: string + label: Capacity + description: Auto-scaling group desired capacity + fixed_subnet_name: + type: string + label: fixed subnetwork ID + description: subnetwork ID used for autoscaling + instance_type: + type: string + label: instance_type + description: type of instance to launch + +resources: + test_pool: + type: OS::Neutron::Pool + properties: + description: Test Pool + lb_method: ROUND_ROBIN + name: test_pool + protocol: HTTP + subnet: { get_param: fixed_subnet_name } + vip: { + "description": "Test VIP", + "protocol_port": 80, + "name": "test_vip" + } + load_balancer: + type: OS::Neutron::LoadBalancer + properties: + protocol_port: 80 + pool_id: { get_resource: test_pool } + launch_config: + type: AWS::AutoScaling::LaunchConfiguration + properties: + ImageId: { get_param: image_id } + InstanceType: { get_param: instance_type } + server_group: + type: AWS::AutoScaling::AutoScalingGroup + properties: + AvailabilityZones : ["nova"] + LaunchConfigurationName : { get_resource : launch_config } + MinSize : 1 + MaxSize : 5 + DesiredCapacity: { get_param: capacity } + LoadBalancerNames : [ { get_resource : load_balancer } ] diff --git a/heat_integrationtests/scenario/test_server_cfn_init.yaml b/heat_integrationtests/scenario/templates/test_server_cfn_init.yaml similarity index 100% rename from heat_integrationtests/scenario/test_server_cfn_init.yaml rename to heat_integrationtests/scenario/templates/test_server_cfn_init.yaml diff --git a/heat_integrationtests/scenario/test_volumes_create_from_backup.yaml b/heat_integrationtests/scenario/templates/test_volumes_create_from_backup.yaml similarity index 100% rename from heat_integrationtests/scenario/test_volumes_create_from_backup.yaml rename to heat_integrationtests/scenario/templates/test_volumes_create_from_backup.yaml diff --git a/heat_integrationtests/scenario/test_volumes_delete_snapshot.yaml b/heat_integrationtests/scenario/templates/test_volumes_delete_snapshot.yaml similarity index 100% rename from heat_integrationtests/scenario/test_volumes_delete_snapshot.yaml rename to heat_integrationtests/scenario/templates/test_volumes_delete_snapshot.yaml diff --git a/heat_integrationtests/scenario/test_neutron_autoscaling.py b/heat_integrationtests/scenario/test_neutron_autoscaling.py index be0132850c..0e3c4049b2 100644 --- a/heat_integrationtests/scenario/test_neutron_autoscaling.py +++ b/heat_integrationtests/scenario/test_neutron_autoscaling.py @@ -12,64 +12,6 @@ from heat_integrationtests.common import test -test_template = ''' -heat_template_version: 2014-10-16 - -description: Auto-scaling Test - -parameters: - image_id: - type: string - label: Image ID - description: Image ID from configurations - capacity: - type: string - label: Capacity - description: Auto-scaling group desired capacity - fixed_subnet_name: - type: string - label: fixed subnetwork ID - description: subnetwork ID used for autoscaling - instance_type: - type: string - label: instance_type - description: type of instance to launch - -resources: - test_pool: - type: OS::Neutron::Pool - properties: - description: Test Pool - lb_method: ROUND_ROBIN - name: test_pool - protocol: HTTP - subnet: { get_param: fixed_subnet_name } - vip: { - "description": "Test VIP", - "protocol_port": 80, - "name": "test_vip" - } - load_balancer: - type: OS::Neutron::LoadBalancer - properties: - protocol_port: 80 - pool_id: { get_resource: test_pool } - launch_config: - type: AWS::AutoScaling::LaunchConfiguration - properties: - ImageId: { get_param: image_id } - InstanceType: { get_param: instance_type } - server_group: - type: AWS::AutoScaling::AutoScalingGroup - properties: - AvailabilityZones : ["nova"] - LaunchConfigurationName : { get_resource : launch_config } - MinSize : 1 - MaxSize : 5 - DesiredCapacity: { get_param: capacity } - LoadBalancerNames : [ { get_resource : load_balancer } ] -''' - class NeutronAutoscalingTest(test.HeatIntegrationTest): """ @@ -106,8 +48,11 @@ class NeutronAutoscalingTest(test.HeatIntegrationTest): "fixed_subnet_name": self.conf.fixed_subnet_name, }} + template = self._load_template(__file__, + 'test_neutron_autoscaling.yaml', + 'templates') # Create stack - stack_id = self.stack_create(template=test_template, + stack_id = self.stack_create(template=template, environment=env) members = self.network_client.list_members() @@ -116,7 +61,7 @@ class NeutronAutoscalingTest(test.HeatIntegrationTest): # Increase desired capacity and update the stack env["parameters"]["capacity"] = "2" self.update_stack(stack_id, - template=test_template, + template=template, environment=env) upd_members = self.network_client.list_members() diff --git a/heat_integrationtests/scenario/test_server_cfn_init.py b/heat_integrationtests/scenario/test_server_cfn_init.py index 64b2a3573d..630e2e9cb9 100644 --- a/heat_integrationtests/scenario/test_server_cfn_init.py +++ b/heat_integrationtests/scenario/test_server_cfn_init.py @@ -27,6 +27,7 @@ class CfnInitIntegrationTest(test.HeatIntegrationTest): raise self.skipException("No image configured to test") self.client = self.orchestration_client self.template_name = 'test_server_cfn_init.yaml' + self.sub_dir = 'templates' def assign_keypair(self): self.stack_name = self._stack_rand_name() @@ -48,7 +49,8 @@ class CfnInitIntegrationTest(test.HeatIntegrationTest): } # create the stack - self.template = self._load_template(__file__, self.template_name) + self.template = self._load_template(__file__, self.template_name, + self.sub_dir) self.client.stacks.create( stack_name=self.stack_name, template=self.template, diff --git a/heat_integrationtests/scenario/test_volumes.py b/heat_integrationtests/scenario/test_volumes.py index 841a0910bb..9953648139 100644 --- a/heat_integrationtests/scenario/test_volumes.py +++ b/heat_integrationtests/scenario/test_volumes.py @@ -56,7 +56,7 @@ class VolumeBackupRestoreIntegrationTest(test.HeatIntegrationTest): # TODO(shardy): refactor this into a generic base-class helper net = self._get_default_network() stack_name = self._stack_rand_name() - template = self._load_template(__file__, template_name) + template = self._load_template(__file__, template_name, 'templates') parameters = {'key_name': self.keypair_name, 'instance_type': self.conf.instance_type, 'image_id': self.conf.minimal_image_ref,