From c1b6d23e29daf2da80722317ec2fd67b39523e3f Mon Sep 17 00:00:00 2001 From: kasturiNarra Date: Tue, 10 Dec 2019 18:16:50 +0530 Subject: Delete duplicate test "test_to_create_distribute_replicated_vol" which completely duplicates "test_to_create_and_delete_dist_rep_vol" in 'test_create_distributed_replica_heketi_volume.py' test module & fix cleanup code for create_heketi_volume_with_name_and_wait in openshift-storage-libs/openshiftstoragelibs/baseclass.py module. Change-Id: I9b3dea28e6330e52caab09311e20b65dd48491b9 --- openshift-storage-libs/openshiftstoragelibs/baseclass.py | 6 ++++-- .../heketi/test_create_distributed_replica_heketi_volume.py | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py index 80f89668..24d0499e 100644 --- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py +++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py @@ -415,7 +415,8 @@ class BaseClass(unittest.TestCase): return self.create_dcs_with_pvc(pvc_name, timeout, wait_step)[pvc_name] def create_heketi_volume_with_name_and_wait( - self, name, size, timeout=600, wait_step=10, **kwargs): + self, name, size, raise_on_cleanup_error=True, + timeout=600, wait_step=10, **kwargs): json = kwargs.get("json", False) try: @@ -445,7 +446,8 @@ class BaseClass(unittest.TestCase): self.addCleanup( heketi_volume_delete, self.heketi_client_node, - self.heketi_server_url, h_volume_info["id"]) + self.heketi_server_url, h_volume_info["id"], + raise_on_error=raise_on_cleanup_error) return h_volume_info diff --git a/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py b/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py index 82fcf704..7c15a232 100644 --- a/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py +++ b/tests/functional/heketi/test_create_distributed_replica_heketi_volume.py @@ -103,7 +103,8 @@ class TestHeketiVolume(BaseClass): h_volume_name = "autotests-heketi-volume-%s" % utils.get_random_str() try: heketi_vol = self.create_heketi_volume_with_name_and_wait( - h_volume_name, vol_size_gb, json=True) + h_volume_name, vol_size_gb, json=True, + raise_on_cleanup_error=False) except AssertionError as e: # NOTE: rare situation when we need to decrease size of a volume. # and we expect this vol to be distributed. @@ -116,7 +117,8 @@ class TestHeketiVolume(BaseClass): vol_size_gb -= 1 heketi_vol = self.create_heketi_volume_with_name_and_wait( - h_volume_name, vol_size_gb, json=True) + h_volume_name, vol_size_gb, json=True, + raise_on_cleanup_error=False) g.log.info("Successfully created distributed volume.") vol_name = heketi_vol['name'] @@ -192,14 +194,10 @@ class TestHeketiVolume(BaseClass): free_space_after_creating_vol, free_space_after_deleting_vol)) - def test_to_create_distribute_replicated_vol(self): + def test_to_create_and_delete_dist_rep_vol(self): """Validate 2x3 vol type creation when the volume cannot be carved out of a single device """ - self._create_distributed_replica_vol(validate_cleanup=False) - - def test_to_create_and_delete_dist_rep_vol(self): - """Validate whether deleting a dist-rep volume is handled by heketi""" self._create_distributed_replica_vol(validate_cleanup=True) @ddt.data(True, False) -- cgit