From 549285cd8c8dafb1151839cb03bd9c56674634a4 Mon Sep 17 00:00:00 2001 From: rabi Date: Tue, 6 Dec 2016 12:11:48 +0530 Subject: [PATCH] Don't use hardcoded flavors in tests Use config values instead. Change-Id: I5755ddc628e08a4336debef4022bebf1542b0200 --- heat_integrationtests/functional/test_cancel_update.py | 2 +- .../functional/test_conditional_exposure.py | 7 ++++++- .../templates/test_volumes_create_from_backup.yaml | 1 - .../scenario/templates/test_volumes_delete_snapshot.yaml | 1 - heat_integrationtests/scenario/test_volumes.py | 5 +++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/heat_integrationtests/functional/test_cancel_update.py b/heat_integrationtests/functional/test_cancel_update.py index f6ddc07051..bfeeda6437 100644 --- a/heat_integrationtests/functional/test_cancel_update.py +++ b/heat_integrationtests/functional/test_cancel_update.py @@ -53,7 +53,7 @@ resources: stack_identifier = self.stack_create(template=self.template, parameters=parameters) - parameters['InstanceType'] = 'm1.large' + parameters['InstanceType'] = self.conf.instance_type self.update_stack(stack_identifier, self.template, parameters=parameters, expected_status='UPDATE_IN_PROGRESS') diff --git a/heat_integrationtests/functional/test_conditional_exposure.py b/heat_integrationtests/functional/test_conditional_exposure.py index bf6cc47d1e..69cff79d78 100644 --- a/heat_integrationtests/functional/test_conditional_exposure.py +++ b/heat_integrationtests/functional/test_conditional_exposure.py @@ -23,13 +23,16 @@ class ServiceBasedExposureTest(functional_base.FunctionalTestsBase): unavailable_service = 'Sahara' unavailable_template = """ heat_template_version: 2015-10-15 +parameters: + instance_type: + type: string resources: not_available: type: OS::Sahara::NodeGroupTemplate properties: plugin_name: fake hadoop_version: 0.1 - flavor: m1.large + flavor: {get_param: instance_type} node_processes: [] """ @@ -56,9 +59,11 @@ resources: def test_unavailable_resources_not_created(self): stack_name = self._stack_rand_name() + parameters = {'instance_type': self.conf.minimal_instance_type} ex = self.assertRaises(exc.HTTPBadRequest, self.client.stacks.create, stack_name=stack_name, + parameters=parameters, template=self.unavailable_template) self.assertIn('ResourceTypeUnavailable', ex.message) self.assertIn('OS::Sahara::NodeGroupTemplate', ex.message) diff --git a/heat_integrationtests/scenario/templates/test_volumes_create_from_backup.yaml b/heat_integrationtests/scenario/templates/test_volumes_create_from_backup.yaml index d6eadd1f5d..ab1edf88a9 100644 --- a/heat_integrationtests/scenario/templates/test_volumes_create_from_backup.yaml +++ b/heat_integrationtests/scenario/templates/test_volumes_create_from_backup.yaml @@ -8,7 +8,6 @@ parameters: instance_type: type: string description: Type of the instance to be created. - default: m1.small image_id: type: string diff --git a/heat_integrationtests/scenario/templates/test_volumes_delete_snapshot.yaml b/heat_integrationtests/scenario/templates/test_volumes_delete_snapshot.yaml index 08f84f1a7d..3893b526cb 100644 --- a/heat_integrationtests/scenario/templates/test_volumes_delete_snapshot.yaml +++ b/heat_integrationtests/scenario/templates/test_volumes_delete_snapshot.yaml @@ -8,7 +8,6 @@ parameters: instance_type: type: string description: Type of the instance to be created. - default: m1.small image_id: type: string diff --git a/heat_integrationtests/scenario/test_volumes.py b/heat_integrationtests/scenario/test_volumes.py index 603c8f2117..47e583dfb0 100644 --- a/heat_integrationtests/scenario/test_volumes.py +++ b/heat_integrationtests/scenario/test_volumes.py @@ -46,7 +46,7 @@ class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase): self.assertEqual(self.volume_description, self._stack_output(stack, 'display_description')) - def check_stack(self, stack_id): + def check_stack(self, stack_id, parameters): stack = self.client.stacks.get(stack_id) # Verify with cinder that the volume exists, with matching details @@ -75,6 +75,7 @@ class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase): try: stack_identifier2 = self.launch_stack( template_name='test_volumes_create_from_backup.yaml', + parameters=parameters, add_parameters={'backup_id': backup.id}) stack2 = self.client.stacks.get(stack_identifier2) except exceptions.StackBuildErrorException: @@ -125,4 +126,4 @@ class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase): ) # Check stack - self.check_stack(stack_id) + self.check_stack(stack_id, parameters)