Fixed issue with backup delete
1) Updated class level create_backup function to wait for resource delete
2) Switched the wait_for_resource_deletion handler before delete_backup,
the clean_up function uses list pop() to perform cleanup. The backup
has to be deleted before the wait_handler is called
Depends-On https://review.opendev.org/c/openstack/tempest/+/781142
https://storyboard.openstack.org/#!/story/2008683
Change-Id: I6ebc6dcb729baa775e36026081cd8bbf0d5c203f
diff --git a/patrole_tempest_plugin/tests/api/volume/rbac_base.py b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
index daf5b6d..e517b67 100644
--- a/patrole_tempest_plugin/tests/api/volume/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
@@ -66,6 +66,9 @@
volume_id=volume_id, **kwargs)['backup']
cls.addClassResourceCleanup(
test_utils.call_and_ignore_notfound_exc,
+ backup_client.wait_for_resource_deletion, backup['id'])
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
backup_client.delete_backup, backup['id'])
waiters.wait_for_volume_resource_status(backup_client, backup['id'],
'available')
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 1245371..0e807e8 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
@@ -103,7 +103,6 @@
backup = self.create_backup(volume_id=self.volume['id'])
waiters.wait_for_volume_resource_status(self.volumes_client,
self.volume['id'], 'available')
-
with self.override_role():
self.backups_client.reset_backup_status(backup_id=backup['id'],
status='error')
diff --git a/releasenotes/notes/volumes-backup-test-cleanup-7ffa74ae3599e6df.yaml b/releasenotes/notes/volumes-backup-test-cleanup-7ffa74ae3599e6df.yaml
new file mode 100644
index 0000000..744a497
--- /dev/null
+++ b/releasenotes/notes/volumes-backup-test-cleanup-7ffa74ae3599e6df.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ fixes an issue in VolumesBackupsV3RbacTest.test_reset_backup_status test
+ where the volume is not registered to be cleaned up after the test.
+ This fix cleans up the volume.