summaryrefslogtreecommitdiffstats
path: root/tests/functional/heketi/test_volume_deletion.py
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-06-24 01:29:41 +0530
committervponomar <vponomar@redhat.com>2019-07-11 09:13:40 +0000
commit32724906d1fd5fd09759e1daf927594461c26d5e (patch)
treeb6744bd1f0b1364e43810c343a873f6022e3e575 /tests/functional/heketi/test_volume_deletion.py
parent1ef65c168d3b45a5af5d263ff3403263810a42d8 (diff)
Make Heketi commands run on a Heketi POD when main command fails
It happens that heketi client located out of the Heketi POD may fail not reaching the server side. So, add back-up approach where we run Heketi commands on a Heketi POD when main commands fail. Change-Id: Ie6ae5be82082f34426f9288b02575e3abd4940f5
Diffstat (limited to 'tests/functional/heketi/test_volume_deletion.py')
-rw-r--r--tests/functional/heketi/test_volume_deletion.py34
1 files changed, 10 insertions, 24 deletions
diff --git a/tests/functional/heketi/test_volume_deletion.py b/tests/functional/heketi/test_volume_deletion.py
index 7b1f2de..97c4924 100644
--- a/tests/functional/heketi/test_volume_deletion.py
+++ b/tests/functional/heketi/test_volume_deletion.py
@@ -53,17 +53,11 @@ class TestVolumeDeleteTestCases(BaseClass):
"Free space is not reclaimed after deletion of %s" % volume_id)
def test_delete_heketidb_volume(self):
- """
- Method to test heketidb volume deletion via heketi-cli
- """
- heketidbexists = False
- msg = "Error: Cannot delete volume containing the Heketi database"
-
+ """Method to test heketidb volume deletion via heketi-cli."""
for i in range(0, 2):
volume_info = heketi_ops.heketi_volume_create(
self.heketi_client_node, self.heketi_server_url,
10, json=True)
-
self.addCleanup(
heketi_ops.heketi_volume_delete, self.heketi_client_node,
self.heketi_server_url, volume_info["id"])
@@ -72,8 +66,8 @@ class TestVolumeDeleteTestCases(BaseClass):
self.heketi_client_node,
self.heketi_server_url, json=True)
- if volume_list_info["volumes"] == []:
- raise ExecutionError("Heketi volume list empty")
+ self.assertTrue(
+ volume_list_info["volumes"], "Heketi volume list empty.")
for volume_id in volume_list_info["volumes"]:
volume_info = heketi_ops.heketi_volume_info(
@@ -81,18 +75,10 @@ class TestVolumeDeleteTestCases(BaseClass):
volume_id, json=True)
if volume_info["name"] == "heketidbstorage":
- heketidbexists = True
- delete_ret, delete_output, delete_error = (
- heketi_ops.heketi_volume_delete(
- self.heketi_client_node,
- self.heketi_server_url, volume_id,
- raw_cli_output=True))
-
- self.assertNotEqual(delete_ret, 0, "Return code not 0")
- self.assertEqual(
- delete_error.strip(), msg,
- "Invalid reason for heketidb deletion failure")
-
- if not heketidbexists:
- raise ExecutionError(
- "Warning: heketidbstorage doesn't exist in list of volumes")
+ self.assertRaises(
+ AssertionError,
+ heketi_ops.heketi_volume_delete,
+ self.heketi_client_node, self.heketi_server_url, volume_id)
+ return
+ raise ExecutionError(
+ "Warning: heketidbstorage doesn't exist in list of volumes")