Adding wait_for_resource_deletion function for volume cleanup
I added a patch: https://review.openstack.org/#/c/308205/
that depends on this patch. The reason is “test_quota_usage” test
does not wait for volume deletion process to complete,
thus a volume is been deleted during my patch. To resolve
this issue I added delete_volume function to serve both tests
in order to prevent race condition.
Change-Id: Ie0f2739fbb4ee32e04dda508d922d0015b1a92a6
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index b2e52bb..cf05f5f 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -30,6 +30,11 @@
super(BaseVolumeQuotasAdminV2TestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.os.credentials.tenant_id
+ def _delete_volume(self, volume_id):
+ # Delete the specified volume using admin credentials
+ self.admin_volume_client.delete_volume(volume_id)
+ self.admin_volume_client.wait_for_resource_deletion(volume_id)
+
@test.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0')
def test_list_quotas(self):
quotas = (self.quotas_client.show_quota_set(self.demo_tenant_id)
@@ -83,8 +88,7 @@
self.demo_tenant_id)['quota_set']
volume = self.create_volume()
- self.addCleanup(self.admin_volume_client.delete_volume,
- volume['id'])
+ self.addCleanup(self._delete_volume, volume['id'])
new_quota_usage = self.quotas_client.show_quota_usage(
self.demo_tenant_id)['quota_set']