Merge "orchestration api add basic volume resource test"

This commit is contained in:
Jenkins 2014-04-28 10:55:36 +00:00 committed by Gerrit Code Review
commit 68a09a1559
3 changed files with 83 additions and 0 deletions
tempest/api/orchestration

@ -41,6 +41,7 @@ class BaseOrchestrationTest(tempest.test.BaseTestCase):
cls.servers_client = cls.os.servers_client
cls.keypairs_client = cls.os.keypairs_client
cls.network_client = cls.os.network_client
cls.volumes_client = cls.os.volumes_client
cls.stacks = []
cls.keypairs = []

@ -0,0 +1,24 @@
heat_template_version: 2013-05-23
resources:
volume:
type: OS::Cinder::Volume
properties:
size: 1
description: a descriptive description
outputs:
status:
description: status
value: { get_attr: ['volume', 'status'] }
size:
description: size
value: { get_attr: ['volume', 'size'] }
display_description:
description: display_description
value: { get_attr: ['volume', 'display_description'] }
volume_id:
value: { get_resource: volume }

@ -0,0 +1,58 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
class CinderResourcesTest(base.BaseOrchestrationTest):
@classmethod
def setUpClass(cls):
super(CinderResourcesTest, cls).setUpClass()
if not CONF.service_available.cinder:
raise cls.skipException('Cinder support is required')
@test.attr(type='gate')
def test_cinder_volume_create_delete(self):
"""Create and delete a volume via OS::Cinder::Volume."""
stack_name = data_utils.rand_name('heat')
template = self.load_template('cinder_basic')
stack_identifier = self.create_stack(stack_name, template)
self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
# Verify with cinder that the volume exists, with matching details
volume_id = self.get_stack_output(stack_identifier, 'volume_id')
self.assertIsNotNone(volume_id)
resp, volume = self.volumes_client.get_volume(volume_id)
self.assertEqual(200, resp.status)
self.assertEqual('available', volume.get('status'))
self.assertEqual(1, volume.get('size'))
self.assertEqual('a descriptive description',
volume.get('display_description'))
# Verify the stack outputs are as expected
self.assertEqual('available',
self.get_stack_output(stack_identifier, 'status'))
self.assertEqual('1',
self.get_stack_output(stack_identifier, 'size'))
self.assertEqual('a descriptive description',
self.get_stack_output(stack_identifier,
'display_description'))