Renames wait_for_volume_status in tempest tests for consistency.

A recent change in Tempest [0] is breaking 2 murano tempest tests;
wait_for_volume_status was changed to wait_for_volume_resource_status,
causing an AttributeError to be thrown [1].

Additionally, a recent change in Cinder [2] removed multiattach
for all drivers, causing one of the murano tempest scenario tests
involving deploying an environment using a multiattach-enabled volume
to fail.

This patch renames the function wait_for_volume_status to be compatible
with the recent Tempest change. It also uses staticmethod delete
functions provided by the Tempest API for delete_volume and
delete_snapshot. It also removes the multiattach property in the
relevant tempest test.

[0] https://review.openstack.org/#/c/394588/29/tempest/common/waiters.py
[1] http://logs.openstack.org/01/435101/2/check/gate-tempest-dsvm-murano-api-ubuntu-xenial/911be71/console.html
[2] https://review.openstack.org/#/c/428365/

Related-Bug: #1668848
Co-Authored-By: ricolin <rico.lin@easystack.cn>
Change-Id: I15ae3f9c931ba606883a22a5af719f79685093a7
This commit is contained in:
Felipe Monteiro 2017-02-23 16:37:11 -05:00 committed by Kirill Zaitsev
parent d3d4418cb1
commit c25e1619ca
2 changed files with 29 additions and 31 deletions

View File

@ -295,9 +295,9 @@ class BaseApplicationCatalogScenarioTest(base.BaseTestCase):
@classmethod
def create_volume(cls, **kwargs):
volume = cls.volumes_client.create_volume(**kwargs)['volume']
waiters.wait_for_volume_status(cls.volumes_client,
volume['id'], 'available')
return volume['id']
waiters.wait_for_volume_resource_status(cls.volumes_client,
volume['id'], 'available')
return volume
@classmethod
def delete_volume(cls, volume_id):
@ -311,9 +311,9 @@ class BaseApplicationCatalogScenarioTest(base.BaseTestCase):
def create_snapshot(self, volume_id):
snapshot = self.snapshots_client.\
create_snapshot(volume_id=volume_id)['snapshot']
waiters.wait_for_snapshot_status(self.snapshots_client,
snapshot['id'], 'available')
return snapshot['id']
waiters.wait_for_volume_resource_status(self.snapshots_client,
snapshot['id'], 'available')
return snapshot
def delete_snapshot(self, snapshot_id):
self.snapshots_client.delete_snapshot(snapshot_id)
@ -327,9 +327,9 @@ class BaseApplicationCatalogScenarioTest(base.BaseTestCase):
backup = self.backups_client.create_backup(
volume_id=volume_id,
force=True)['backup']
waiters.wait_for_backup_status(self.backups_client,
backup['id'], 'available')
return backup['id']
waiters.wait_for_volume_resource_status(self.backups_client,
backup['id'], 'available')
return backup
def delete_backup(self, backup_id):
self.backups_client.delete_backup(backup_id)

View File

@ -49,7 +49,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
@classmethod
def resource_cleanup(cls):
cls.delete_volume(cls.volume)
cls.delete_volume(cls.volume['id'])
cls.client.delete_package(cls.package['id'])
os.remove(cls.abs_archive_path)
super(TestCinderVolumes, cls).resource_cleanup()
@ -148,7 +148,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
"?": {
"type": "io.murano.resources.ExistingCinderVolume"
},
"openstackId": self.volume
"openstackId": self.volume['id']
}
}
post_body = self.vm_cinder(attributes=volume_attributes)
@ -157,7 +157,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
post_body)
self.deploy_environment(environment, session)
self.check_volume_attached('testMurano', self.volume)
self.check_volume_attached('testMurano', self.volume['id'])
@testtools.testcase.attr('smoke')
@testtools.testcase.attr('scenario')
@ -274,7 +274,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
"?": {
"type": "io.murano.resources.ExistingCinderVolume"
},
"openstackId": self.volume
"openstackId": self.volume['id']
}
}
}
@ -287,7 +287,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
volume_data = self.get_volume(environment['id'])
self.check_volume_attached('testMurano', volume_data['id'])
self.assertEqual(volume_data['size'], 1)
self.assertEqual(volume_data['source_volid'], self.volume)
self.assertEqual(volume_data['source_volid'], self.volume['id'])
@testtools.testcase.attr('smoke')
@testtools.testcase.attr('scenario')
@ -307,8 +307,8 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
created from existing volume snapshot
8. Delete environment, snapshot
"""
snapshot = self.create_snapshot(self.volume)
self.addCleanup(self.delete_snapshot, snapshot)
snapshot = self.create_snapshot(self.volume['id'])
self.addCleanup(self.delete_snapshot, snapshot['id'])
name = utils.generate_name('testMurano')
environment = self.application_catalog_client.\
create_environment(name)
@ -325,7 +325,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
"?": {
"type": "io.murano.resources.CinderVolumeSnapshot"
},
"openstackId": snapshot
"openstackId": snapshot['id']
}
}
}
@ -338,7 +338,7 @@ class TestCinderVolumes(base.BaseApplicationCatalogScenarioTest):
volume_data = self.get_volume(environment['id'])
self.check_volume_attached('testMurano', volume_data['id'])
self.assertEqual(volume_data['size'], 1)
self.assertEqual(volume_data['snapshot_id'], snapshot)
self.assertEqual(volume_data['snapshot_id'], snapshot['id'])
class TestCinderVolumeIsolatedAdmin(
@ -367,26 +367,26 @@ class TestCinderVolumeIsolatedAdmin(
@classmethod
def resource_cleanup(cls):
cls.delete_volume(cls.volume)
cls.delete_volume(cls.volume['id'])
cls.client.delete_package(cls.package['id'])
os.remove(cls.abs_archive_path)
super(TestCinderVolumeIsolatedAdmin, cls).resource_cleanup()
@testtools.testcase.attr('smoke')
@testtools.testcase.attr('scenario')
def test_deploy_app_with_volume_creation_readonly_multiattach(self):
"""Test app deploy with volume creation with multiattach and readonly
def test_deploy_app_with_volume_creation_readonly(self):
"""Test app deploy with volume creation with readonly
Scenario:
1. Create environment
2. Add VM application with ability to create and
attach Cinder volume with size 1 GiB, multiattach and readonly
attach Cinder volume with size 1 GiB and readonly
properties to the instance
3. Deploy environment
4. Make sure that deployment finished successfully
5. Check that application is accessible
6. Check that volume is attached to the instance, has size 1GiB,
multiattach, readonly attributes
and readonly attributes
7. Delete environment
"""
name = utils.generate_name('testMurano')
@ -401,8 +401,7 @@ class TestCinderVolumeIsolatedAdmin(
"type": "io.murano.resources.CinderVolume"
},
"size": 1,
"readOnly": True,
"multiattach": True
"readOnly": True
}
}
post_body = self.vm_cinder(attributes=volume_attributes)
@ -415,7 +414,6 @@ class TestCinderVolumeIsolatedAdmin(
self.check_volume_attached('testMurano', volume_data['id'])
self.assertEqual(volume_data['size'], 1)
self.assertEqual(volume_data['metadata']['readonly'], 'True')
self.assertTrue(volume_data['multiattach'])
@testtools.testcase.attr('smoke')
@testtools.testcase.attr('scenario')
@ -442,8 +440,8 @@ class TestCinderVolumeIsolatedAdmin(
"will be skipped.")
raise self.skipException(msg)
backup = self.create_backup(self.volume)
self.addCleanup(self.delete_backup, backup)
backup = self.create_backup(self.volume['id'])
self.addCleanup(self.delete_backup, backup['id'])
name = utils.generate_name('testMurano')
environment = self.application_catalog_client. \
create_environment(name)
@ -456,12 +454,12 @@ class TestCinderVolumeIsolatedAdmin(
"type": "io.murano.resources.CinderVolume"
},
"size": 1,
"name": "restore_backup_" + backup,
"name": "restore_backup_" + backup['id'],
"sourceVolumeBackup": {
"?": {
"type": "io.murano.resources.CinderVolumeBackup"
},
"openstackId": backup
"openstackId": backup['id']
}
}
}
@ -474,4 +472,4 @@ class TestCinderVolumeIsolatedAdmin(
volume_data = self.get_volume(environment['id'])
self.check_volume_attached('testMurano', volume_data['id'])
self.assertEqual(volume_data['size'], 1)
self.assertIn(backup, volume_data['name'])
self.assertIn(backup['id'], volume_data['name'])