From b11548de243f5fa2f91316469b6f040b02cf73af Mon Sep 17 00:00:00 2001 From: Elena Bondarenko <40801241+ebondare@users.noreply.github.com> Date: Thu, 16 May 2024 11:31:25 +0200 Subject: [PATCH] Run pvc resize and clone on all clients (#9773) Signed-off-by: Elena Bondarenko --- .../multicluster/test_acceptance.py | 158 +++++++++--------- 1 file changed, 82 insertions(+), 76 deletions(-) diff --git a/tests/cross_functional/system_test/multicluster/test_acceptance.py b/tests/cross_functional/system_test/multicluster/test_acceptance.py index 465640d6bf7e..42a4960d8252 100644 --- a/tests/cross_functional/system_test/multicluster/test_acceptance.py +++ b/tests/cross_functional/system_test/multicluster/test_acceptance.py @@ -7,6 +7,7 @@ acceptance, provider_client_ms_platform_required, ) +from ocs_ci.framework import config as ocsci_config from ocs_ci.ocs.resources import pvc from ocs_ci.utility.utils import TimeoutSampler from ocs_ci.helpers import helpers @@ -25,90 +26,95 @@ class TestAcceptance(ManageTest): @provider_client_ms_platform_required def test_acceptance(self, pvc_factory, pod_factory, teardown_factory): """ - Acceptance test + Acceptance test on all clients 1.Create pvc with all relevant modes 2.Create new FIO pod for each pvc 3.Run FIO with verify flag 4.Create clone to all PVCs 5.Resize all PVCs """ - modes = [ - ( - constants.CEPHBLOCKPOOL, - constants.ACCESS_MODE_RWO, - constants.VOLUME_MODE_FILESYSTEM, - ), - ( - constants.CEPHFILESYSTEM, - constants.ACCESS_MODE_RWO, - constants.VOLUME_MODE_FILESYSTEM, - ), - ( - constants.CEPHFILESYSTEM, - constants.ACCESS_MODE_RWX, - constants.VOLUME_MODE_FILESYSTEM, - ), - ( - constants.CEPHBLOCKPOOL, - constants.ACCESS_MODE_RWO, - constants.VOLUME_MODE_BLOCK, - ), - ( - constants.CEPHBLOCKPOOL, - constants.ACCESS_MODE_RWX, - constants.VOLUME_MODE_BLOCK, - ), - ] - self.pod_objs = list() - self.pvc_objs = list() - for mode in modes: - pvc_obj = pvc_factory( - interface=mode[0], - access_mode=mode[1], - size=2, - volume_mode=mode[2], - status=constants.STATUS_BOUND, - ) - logger.info( - f"Created new pvc {pvc_obj.name} sc_name={mode[0]} size=2Gi, " - f"access_mode={mode[1]}, volume_mode={mode[2]}" - ) - self.pvc_objs.append(pvc_obj) - if mode[2] == constants.VOLUME_MODE_BLOCK: - pod_dict_path = constants.CSI_RBD_RAW_BLOCK_POD_YAML - storage_type = constants.WORKLOAD_STORAGE_TYPE_BLOCK - raw_block_pv = True - else: - pod_dict_path = constants.NGINX_POD_YAML - storage_type = constants.WORKLOAD_STORAGE_TYPE_FS - raw_block_pv = False - logger.info( - f"Created new pod sc_name={mode[0]} size=2Gi, access_mode={mode[1]}, volume_mode={mode[2]}" - ) - pod_obj = pod_factory( - interface=mode[0], - pvc=pvc_obj, - status=constants.STATUS_RUNNING, - pod_dict_path=pod_dict_path, - raw_block_pv=raw_block_pv, - ) - pod_obj.run_io( - storage_type=storage_type, - size="1GB", - verify=True, - ) - self.pod_objs.append(pod_obj) + orig_index = ocsci_config.cur_index + client_indexes = ocsci_config.get_consumer_indexes_list() + for client_i in client_indexes: + ocsci_config.switch_ctx(client_i) + modes = [ + ( + constants.CEPHBLOCKPOOL, + constants.ACCESS_MODE_RWO, + constants.VOLUME_MODE_FILESYSTEM, + ), + ( + constants.CEPHFILESYSTEM, + constants.ACCESS_MODE_RWO, + constants.VOLUME_MODE_FILESYSTEM, + ), + ( + constants.CEPHFILESYSTEM, + constants.ACCESS_MODE_RWX, + constants.VOLUME_MODE_FILESYSTEM, + ), + ( + constants.CEPHBLOCKPOOL, + constants.ACCESS_MODE_RWO, + constants.VOLUME_MODE_BLOCK, + ), + ( + constants.CEPHBLOCKPOOL, + constants.ACCESS_MODE_RWX, + constants.VOLUME_MODE_BLOCK, + ), + ] + self.pod_objs = list() + self.pvc_objs = list() + for mode in modes: + pvc_obj = pvc_factory( + interface=mode[0], + access_mode=mode[1], + size=2, + volume_mode=mode[2], + status=constants.STATUS_BOUND, + ) + logger.info( + f"Created new pvc {pvc_obj.name} sc_name={mode[0]} size=2Gi, " + f"access_mode={mode[1]}, volume_mode={mode[2]}" + ) + self.pvc_objs.append(pvc_obj) + if mode[2] == constants.VOLUME_MODE_BLOCK: + pod_dict_path = constants.CSI_RBD_RAW_BLOCK_POD_YAML + storage_type = constants.WORKLOAD_STORAGE_TYPE_BLOCK + raw_block_pv = True + else: + pod_dict_path = constants.NGINX_POD_YAML + storage_type = constants.WORKLOAD_STORAGE_TYPE_FS + raw_block_pv = False + logger.info( + f"Created new pod sc_name={mode[0]} size=2Gi, access_mode={mode[1]}, volume_mode={mode[2]}" + ) + pod_obj = pod_factory( + interface=mode[0], + pvc=pvc_obj, + status=constants.STATUS_RUNNING, + pod_dict_path=pod_dict_path, + raw_block_pv=raw_block_pv, + ) + pod_obj.run_io( + storage_type=storage_type, + size="1GB", + verify=True, + ) + self.pod_objs.append(pod_obj) - for pod_obj in self.pod_objs: - fio_result = pod_obj.get_fio_results() - logger.info("IOPs after FIO:") - reads = fio_result.get("jobs")[0].get("read").get("iops") - writes = fio_result.get("jobs")[0].get("write").get("iops") - logger.info(f"Read: {reads}") - logger.info(f"Write: {writes}") + for pod_obj in self.pod_objs: + fio_result = pod_obj.get_fio_results() + logger.info("IOPs after FIO:") + reads = fio_result.get("jobs")[0].get("read").get("iops") + writes = fio_result.get("jobs")[0].get("write").get("iops") + logger.info(f"Read: {reads}") + logger.info(f"Write: {writes}") - self.clone_pvc(teardown_factory=teardown_factory) - self.resize_pvc(pvc_size_new=3) + self.clone_pvc(teardown_factory=teardown_factory) + self.resize_pvc(pvc_size_new=3) + ocsci_config.switch_ctx(orig_index) def clone_pvc(self, teardown_factory): """