Skip to content

Commit

Permalink
Run pvc resize and clone on all clients (red-hat-storage#9773)
Browse files Browse the repository at this point in the history
Signed-off-by: Elena Bondarenko <[email protected]>
  • Loading branch information
ebondare authored and amr1ta committed May 27, 2024
1 parent a073201 commit b11548d
Showing 1 changed file with 82 additions and 76 deletions.
158 changes: 82 additions & 76 deletions tests/cross_functional/system_test/multicluster/test_acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
"""
Expand Down

0 comments on commit b11548d

Please sign in to comment.