Add volume cleanup to test_volume_transfer test
The tempest tests were leaving volumes behind when it
finished up. Turns out these were from the test_volume_transfer
tests.
The normal delete/cleanup methods can't be used here because we do
the whole bit of transferring the ownership of the volume so the base
client isn't the one that ends up having access to the volume.
This patch adds a delete and wait for cleanup method that's called
by the addition of an addCleanup task.
Change-Id: I6d27c7748ae386d97e727ddf0f8bb94046e6e88d
Closes-Bug: 1272533
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 8710d82..4ee7bd0 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -55,10 +55,17 @@
cls.alt_client = cls.os_alt.volumes_client
cls.adm_client = cls.os_adm.volumes_client
+ def _delete_volume(self, volume_id):
+ # Delete the specified volume using admin creds
+ resp, _ = self.adm_client.delete_volume(volume_id)
+ self.assertEqual(202, resp.status)
+ self.adm_client.wait_for_resource_deletion(volume_id)
+
@attr(type='gate')
def test_create_get_list_accept_volume_transfer(self):
# Create a volume first
volume = self.create_volume()
+ self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
resp, transfer = self.client.create_volume_transfer(volume['id'])
@@ -88,6 +95,7 @@
def test_create_list_delete_volume_transfer(self):
# Create a volume first
volume = self.create_volume()
+ self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
resp, body = self.client.create_volume_transfer(volume['id'])