Fixes test_volume_backup_delete failing during tearDown.
This test is currently failing because after doing
self.backups_client.delete_backup(), the backup
goes into deleting status, and directly afterward tearDown
is called, during which the
test_utils.call_and_ignore_notfound_exc calls the
backup deletion method again... However, the backup
is still in deleting status, as it has not been fully
deleted, causing a 400 Bad Request to be thrown.
This patch adds a waiter (wait_for_resource_deletion)
call right after the first delete backup call is made.
Change-Id: Ie3e8e7371bb169043377bfd4e04c1320f8939004
Partial-Bug: #1670553
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py
index 8480d01..36ee02e 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py
@@ -33,16 +33,6 @@
if not CONF.volume_feature_enabled.backup:
raise cls.skipException("Cinder backup feature disabled")
- def create_backup(self, volume_id):
- backup_name = data_utils.rand_name(
- self.__class__.__name__ + '-backup')
- backup = self.backups_client.create_backup(
- volume_id=volume_id, name=backup_name)['backup']
- self.addCleanup(self.backups_client.delete_backup, backup['id'])
- waiters.wait_for_backup_status(self.backups_client, backup['id'],
- 'available')
- return backup
-
@classmethod
def resource_setup(cls):
super(VolumesBackupsRbacTest, cls).resource_setup()
@@ -104,6 +94,7 @@
self.rbac_utils.switch_role(self, switchToRbacRole=True)
# Delete backup
self.backups_client.delete_backup(backup['id'])
+ self.backups_client.wait_for_resource_deletion(backup['id'])
class VolumesBackupsV3RbacTest(VolumesBackupsRbacTest):