From 1c940844a06d78d30934b48cb0965a82c669a5be Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Thu, 3 Mar 2016 13:57:33 -0600 Subject: [PATCH] Allow heat volume tests to use configured volume size Heat volumne tests have templates with hardcoded volume size. This patch allow that to come from the tempest.conf. Change-Id: I806418c0d290bfcf969be62c6103ef63581a0cde --- .../stacks/templates/cinder_basic.yaml | 7 ++++++- .../templates/cinder_basic_delete_retain.yaml | 7 ++++++- .../api/orchestration/stacks/test_volumes.py | 21 +++++++++++++------ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/tempest/api/orchestration/stacks/templates/cinder_basic.yaml b/tempest/api/orchestration/stacks/templates/cinder_basic.yaml index ffff58055f..61c271c6c5 100644 --- a/tempest/api/orchestration/stacks/templates/cinder_basic.yaml +++ b/tempest/api/orchestration/stacks/templates/cinder_basic.yaml @@ -1,10 +1,15 @@ heat_template_version: 2013-05-23 +parameters: + volume_size: + type: number + default: 1 + resources: volume: type: OS::Cinder::Volume properties: - size: 1 + size: { get_param: volume_size } description: a descriptive description name: volume_name diff --git a/tempest/api/orchestration/stacks/templates/cinder_basic_delete_retain.yaml b/tempest/api/orchestration/stacks/templates/cinder_basic_delete_retain.yaml index b660c19c4c..0bc6d69af5 100644 --- a/tempest/api/orchestration/stacks/templates/cinder_basic_delete_retain.yaml +++ b/tempest/api/orchestration/stacks/templates/cinder_basic_delete_retain.yaml @@ -1,11 +1,16 @@ heat_template_version: 2013-05-23 +parameters: + volume_size: + type: number + default: 1 + resources: volume: deletion_policy: 'Retain' type: OS::Cinder::Volume properties: - size: 1 + size: { get_param: volume_size } description: a descriptive description name: volume_name diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py index 37e68ef7ec..a5aaf6eb22 100644 --- a/tempest/api/orchestration/stacks/test_volumes.py +++ b/tempest/api/orchestration/stacks/test_volumes.py @@ -32,8 +32,7 @@ class CinderResourcesTest(base.BaseOrchestrationTest): self.assertIsNotNone(volume_id) volume = self.volumes_client.show_volume(volume_id)['volume'] self.assertEqual('available', volume.get('status')) - self.assertEqual(template['resources']['volume']['properties'][ - 'size'], volume.get('size')) + self.assertEqual(CONF.volume.volume_size, volume.get('size')) # Some volume properties have been renamed with Cinder v2 if CONF.volume_feature_enabled.api_v2: @@ -51,8 +50,8 @@ class CinderResourcesTest(base.BaseOrchestrationTest): def _outputs_verify(self, stack_identifier, template): self.assertEqual('available', self.get_stack_output(stack_identifier, 'status')) - self.assertEqual(str(template['resources']['volume']['properties'][ - 'size']), self.get_stack_output(stack_identifier, 'size')) + self.assertEqual(str(CONF.volume.volume_size), + self.get_stack_output(stack_identifier, 'size')) self.assertEqual(template['resources']['volume']['properties'][ 'description'], self.get_stack_output(stack_identifier, 'display_description')) @@ -65,7 +64,12 @@ class CinderResourcesTest(base.BaseOrchestrationTest): """Create and delete a volume via OS::Cinder::Volume.""" stack_name = data_utils.rand_name('heat') template = self.read_template('cinder_basic') - stack_identifier = self.create_stack(stack_name, template) + stack_identifier = self.create_stack( + stack_name, + template, + parameters={ + 'volume_size': CONF.volume.volume_size + }) self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE') # Verify with cinder that the volume exists, with matching details @@ -94,7 +98,12 @@ class CinderResourcesTest(base.BaseOrchestrationTest): """Ensure the 'Retain' deletion policy is respected.""" stack_name = data_utils.rand_name('heat') template = self.read_template('cinder_basic_delete_retain') - stack_identifier = self.create_stack(stack_name, template) + stack_identifier = self.create_stack( + stack_name, + template, + parameters={ + 'volume_size': CONF.volume.volume_size + }) self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE') # Verify with cinder that the volume exists, with matching details