Don't use hardcoded flavors in tests

Use config values instead.

Change-Id: I5755ddc628e08a4336debef4022bebf1542b0200
This commit is contained in:
rabi 2016-12-06 12:11:48 +05:30
parent 4078e228dd
commit 549285cd8c
5 changed files with 10 additions and 6 deletions

View File

@ -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')

View File

@ -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)

View File

@ -8,7 +8,6 @@ parameters:
instance_type:
type: string
description: Type of the instance to be created.
default: m1.small
image_id:
type: string

View File

@ -8,7 +8,6 @@ parameters:
instance_type:
type: string
description: Type of the instance to be created.
default: m1.small
image_id:
type: string

View File

@ -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)