Merge "Make CinderVolume attachment info available"

This commit is contained in:
Jenkins 2017-04-17 09:48:08 +00:00 committed by Gerrit Code Review
commit cf4eb0cba2
2 changed files with 23 additions and 2 deletions

View File

@ -338,10 +338,29 @@ class BaseApplicationCatalogScenarioTest(base.BaseTestCase):
stack_outputs = self.orchestration_client.\
show_stack(stack)['stack']['outputs']
for output in stack_outputs:
if 'vol' in output['output_key']:
if (output['output_key'].startswith('vol-') and
output['output_key'].endswith('-id')):
volume_id = output['output_value']
return self.volumes_client.show_volume(volume_id)['volume']
def get_volume_attachments(self, environment_id):
stack = self.get_stack_id(environment_id)
stack_outputs = self.orchestration_client.\
show_stack(stack)['stack']['outputs']
for output in stack_outputs:
if (output['output_key'].startswith('vol-') and
output['output_key'].endswith('-attachments')):
return output['output_value']
def check_volume_attachments(self, environment_id):
volume_attachments = self.get_volume_attachments(environment_id)
self.assertIsInstance(volume_attachments, list)
self.assertGreater(len(volume_attachments), 0)
instance_id = self.get_instance_id('testMurano')
for attachment in volume_attachments:
self.assertEqual(attachment.get('server_id'), instance_id)
self.assertTrue(attachment.get('device').startswith('/dev/'))
def check_volume_attached(self, name, volume_id):
instance_id = self.get_instance_id(name)
attached_volumes = self.servers_client.\

View File

@ -172,7 +172,8 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
4. Make sure that deployment finished successfully
5. Check that application is accessible
6. Check that volume is attached to the instance and has size 1GiB
7. Delete environment
7. Check that we can access some attachment info about the volume
8. Delete environment
"""
name = utils.generate_name('testMurano')
environment = self.application_catalog_client.\
@ -196,6 +197,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
volume_data = self.get_volume(environment['id'])
self.check_volume_attached('testMurano', volume_data['id'])
self.check_volume_attachments(environment['id'])
self.assertEqual(volume_data['size'], 1)
@testtools.testcase.attr('smoke')