summaryrefslogtreecommitdiffstats
path: root/tests/functional/gluster_stability/test_gluster_block_stability.py
diff options
context:
space:
mode:
authorvamahaja <vamahaja@redhat.com>2019-09-25 20:15:46 +0530
committervamahaja <vamahaja@redhat.com>2019-10-17 17:05:42 +0530
commit70ded8d3fbfe0b9962d7b4d83edee25044c5ab9b (patch)
tree4ab10eb5e8d0a3369543fe6aeb4bab725c3ee2f5 /tests/functional/gluster_stability/test_gluster_block_stability.py
parent22d5a75ea92b555beb6da357dc4f46908b17248e (diff)
Add library to get heketi block volumes by name prefix
This change required due to - 1. Get block volume by prefix is common step which is used in two places for now and will be used in other places too. 2. Hence add library "heketi_blockvolume_list_by_name_prefix" in heketi_ops.py. 3. And use added library and update code from class "GlusterStabilityTestSetup" and "TestGlusterBlockStability". Change-Id: I9e60d58d5c84380104081335745270b3d21ff071 Signed-off-by: vamahaja <vamahaja@redhat.com>
Diffstat (limited to 'tests/functional/gluster_stability/test_gluster_block_stability.py')
-rw-r--r--tests/functional/gluster_stability/test_gluster_block_stability.py43
1 files changed, 8 insertions, 35 deletions
diff --git a/tests/functional/gluster_stability/test_gluster_block_stability.py b/tests/functional/gluster_stability/test_gluster_block_stability.py
index 5cbf3783..13b8cc85 100644
--- a/tests/functional/gluster_stability/test_gluster_block_stability.py
+++ b/tests/functional/gluster_stability/test_gluster_block_stability.py
@@ -20,6 +20,7 @@ from openshiftstoragelibs.heketi_ops import (
heketi_blockvolume_delete,
heketi_blockvolume_info,
heketi_blockvolume_list,
+ heketi_blockvolume_list_by_name_prefix,
heketi_node_info,
heketi_node_list,
)
@@ -70,8 +71,6 @@ from openshiftstoragelibs.openshift_version import (
from openshiftstoragelibs import utils
from openshiftstoragelibs.waiter import Waiter
-HEKETI_BLOCK_VOLUME_REGEX = "^Id:(.*).Cluster:(.*).Name:%s_(.*)$"
-
@ddt.ddt
class TestGlusterBlockStability(GlusterBlockBaseClass):
@@ -92,36 +91,7 @@ class TestGlusterBlockStability(GlusterBlockBaseClass):
"Skipping this test case as multipath validation "
"is not supported in OCS 3.9")
- def get_heketi_block_volumes(self, vol_prefix):
- """Get list of heketi block volumes filtered by prefix
-
- Args:
- vol_prefix (str): volume name prefix used for the block PVC
-
- Returns:
- A tuple containing two lists of heketi block volume IDs and names
- """
-
- heketi_cmd_out = heketi_blockvolume_list(
- self.heketi_client_node, self.heketi_server_url,
- secret=self.heketi_cli_key, user=self.heketi_cli_user
- )
- heketi_block_volume_ids, heketi_block_volume_names = [], []
-
- for block_vol in heketi_cmd_out.split("\n"):
- heketi_vol_match = re.search(
- HEKETI_BLOCK_VOLUME_REGEX % vol_prefix, block_vol.strip())
- if heketi_vol_match:
- heketi_block_volume_ids.append(
- (heketi_vol_match.group(1)).strip())
- heketi_block_volume_names.append(
- (heketi_vol_match.group(3)).strip())
-
- return (sorted(heketi_block_volume_ids), sorted(
- heketi_block_volume_names))
-
def bulk_app_pods_creation_with_block_pv(self, app_pod_count):
-
prefix = "autotest-%s" % utils.get_random_str()
self.create_storage_class(sc_name_prefix=prefix,
create_vol_name_prefix=True, set_hacount=3)
@@ -139,16 +109,19 @@ class TestGlusterBlockStability(GlusterBlockBaseClass):
iqn, _, ini_node = self.verify_iscsi_sessions_and_multipath(
pvc_name, dc_name)
- heketi_block_volume_ids, heketi_block_volume_names = (
- self.get_heketi_block_volumes(vol_prefix=prefix))
+ h_blockvol_list = heketi_blockvolume_list_by_name_prefix(
+ self.heketi_client_node, self.heketi_server_url, self.prefix)
# validate block volumes listed by heketi and pvs
+ heketi_blockvolume_ids = sorted([bv[0] for bv in h_blockvol_list])
match_pv_and_heketi_block_volumes(
- self.node, heketi_block_volume_ids, pvc_prefix=prefix)
+ self.node, heketi_blockvolume_ids, pvc_prefix=prefix)
# validate block volumes listed by heketi and gluster
+ heketi_blockvolume_names = sorted([
+ bv[1].replace("%s_" % prefix, "") for bv in h_blockvol_list])
match_heketi_and_gluster_block_volumes_by_prefix(
- heketi_block_volume_names, block_vol_prefix=(prefix + "_"))
+ heketi_blockvolume_names, "%s_" % prefix)
def initiator_side_failures(self):
self.create_storage_class()