summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormelanie witt <melwittt@gmail.com>2018-05-31 00:05:00 +0000
committermelanie witt <melwittt@gmail.com>2018-06-02 00:52:13 +0000
commitc96757b275a77a745c6c80947bdd0bcb2de7eefd (patch)
treeadfbbf999ba622476da7bab60b79a04ca17c465b
parent28456a1234ad2e3d158237644c9c262a57cc2ee1 (diff)
downloadcinder-tempest-plugin-c96757b275a77a745c6c80947bdd0bcb2de7eefd.zip
cinder-tempest-plugin-c96757b275a77a745c6c80947bdd0bcb2de7eefd.tar.gz
cinder-tempest-plugin-c96757b275a77a745c6c80947bdd0bcb2de7eefd.tar.bz2
Remove redundant cleanups in test_volume_backup
The BaseVolumeTest class contains some helper methods that do their own cleanup steps within them. However, several of the tests in VolumesBackupsTest were also doing identical cleanup. Occasionally, this results in a failure to cleanup in the gate [1] because a test that doesn't wait for resource deletion [2] after it cleans up a resource can leave a resource in a mid-deletion state that the base class cleanup will fail with a 400 when *it* tries to delete the same resource. This was noticed on the Ocata branch but it looks like the same issues exist on master in the plugin, so I'm starting with the fix here. Closes-Bug: #1774684 [1] http://logs.openstack.org/53/570653/1/check/legacy-tempest-dsvm-full-devstack-plugin-ceph/c5d03e7/job-output.txt.gz#_2018-05-30_04_41_10_689262 [2] https://github.com/openstack/cinder-tempest-plugin/blob/28456a1/cinder_tempest_plugin/api/volume/test_volume_backup.py#L64 Change-Id: I2a29daf56f8327fce405e7969767dc9993849f19
-rw-r--r--cinder_tempest_plugin/api/volume/base.py4
-rw-r--r--cinder_tempest_plugin/api/volume/test_volume_backup.py41
2 files changed, 7 insertions, 38 deletions
diff --git a/cinder_tempest_plugin/api/volume/base.py b/cinder_tempest_plugin/api/volume/base.py
index b3765e0..50ee60a 100644
--- a/cinder_tempest_plugin/api/volume/base.py
+++ b/cinder_tempest_plugin/api/volume/base.py
@@ -143,7 +143,9 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
backup = backup_client.create_backup(
volume_id=volume_id, **kwargs)['backup']
- self.addCleanup(backup_client.delete_backup, backup['id'])
+ self.addCleanup(backup_client.wait_for_resource_deletion, backup['id'])
+ self.addCleanup(test_utils.call_and_ignore_notfound_exc,
+ backup_client.delete_backup, backup['id'])
waiters.wait_for_volume_resource_status(backup_client, backup['id'],
'available')
return backup
diff --git a/cinder_tempest_plugin/api/volume/test_volume_backup.py b/cinder_tempest_plugin/api/volume/test_volume_backup.py
index 4eb7703..8c81543 100644
--- a/cinder_tempest_plugin/api/volume/test_volume_backup.py
+++ b/cinder_tempest_plugin/api/volume/test_volume_backup.py
@@ -41,35 +41,16 @@ class VolumesBackupsTest(base.BaseVolumeTest):
backup = self.create_backup(
volume_id=volume['id'],
snapshot_id=snapshot['id'])
- # Get a given backup
- backup = self.backups_client.show_backup(
- backup['id'])['backup']
- waiters.wait_for_volume_resource_status(
- self.backups_client,
- backup['id'], 'available')
self.assertEqual(volume['id'], backup['volume_id'])
self.assertEqual(snapshot['id'], backup['snapshot_id'])
- self.snapshots_client.delete_snapshot(snapshot['id'])
- self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
-
- self.volumes_client.delete_volume(volume['id'])
- self.volumes_client.wait_for_resource_deletion(volume['id'])
-
@decorators.idempotent_id('b5d837b0-7066-455d-88fc-4a721a899306')
def test_backup_create_and_restore_to_an_existing_volume(self):
"""Test backup create and restore to an existing volume."""
# Create volume
src_vol = self.create_volume()
- self.addCleanup(self.volumes_client.delete_volume,
- src_vol['id'])
# Create backup
- backup = self.backups_client.create_backup(
- volume_id=src_vol['id'])['backup']
- self.addCleanup(self.backups_client.delete_backup, backup['id'])
- waiters.wait_for_volume_resource_status(
- self.backups_client,
- backup['id'], 'available')
+ backup = self.create_backup(volume_id=src_vol['id'])
# Restore to existing volume
restore = self.backups_client.restore_backup(
backup_id=backup['id'],
@@ -89,14 +70,9 @@ class VolumesBackupsTest(base.BaseVolumeTest):
# Create volume from image
volume = self.create_volume(size=CONF.volume.volume_size,
imageRef=CONF.compute.image_ref)
- self.addCleanup(self.volumes_client.delete_volume,
- volume['id'])
# Create backup
- backup = self.backups_client.create_backup(
- volume_id=volume['id'])['backup']
- waiters.wait_for_volume_resource_status(self.backups_client,
- backup['id'], 'available')
+ self.create_backup(volume_id=volume['id'])
# Create a server
bd_map = [{'volume_id': volume['id'],
'delete_on_termination': '0'}]
@@ -112,19 +88,10 @@ class VolumesBackupsTest(base.BaseVolumeTest):
# Create incremental backup
waiters.wait_for_volume_resource_status(self.volumes_client,
volume['id'], 'available')
- backup_incr = self.backups_client.create_backup(
+ backup_incr = self.create_backup(
volume_id=volume['id'],
- incremental=True)['backup']
-
- waiters.wait_for_volume_resource_status(self.backups_client,
- backup_incr['id'],
- 'available')
+ incremental=True)
is_incremental = self.backups_client.show_backup(
backup_incr['id'])['backup']['is_incremental']
self.assertTrue(is_incremental)
-
- self.backups_client.delete_backup(backup_incr['id'])
- self.backups_client.wait_for_resource_deletion(backup_incr['id'])
- self.backups_client.delete_backup(backup['id'])
- self.backups_client.wait_for_resource_deletion(backup['id'])

This mirror site include all the OpenStack related repositories under: openstack, openstack-dev and openstack-infra.

NOTE: All repositories are updated every one hour.

Usage

For Git Clone
 git clone http://git.trystack.cn/openstack/nova.git 
For DevStack

Add GIT_BASE, NOVNC_REPO and SPICE_REPO variables to local.conf file.

[[local|localrc]]

# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git