From f6a39caaf856c06551340556504b8ef25d10331d Mon Sep 17 00:00:00 2001 From: Mahesh Shetty Date: Thu, 7 Nov 2024 13:00:47 +0530 Subject: [PATCH] add cnv workloads to the add capacity and device replacement tests Signed-off-by: Mahesh Shetty --- .../sc_arbiter/test_add_capacity.py | 31 ++++++++++++++++++ .../sc_arbiter/test_device_replacement.py | 32 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/tests/functional/disaster-recovery/sc_arbiter/test_add_capacity.py b/tests/functional/disaster-recovery/sc_arbiter/test_add_capacity.py index 8ee03eecf50..ef7ffb72c63 100644 --- a/tests/functional/disaster-recovery/sc_arbiter/test_add_capacity.py +++ b/tests/functional/disaster-recovery/sc_arbiter/test_add_capacity.py @@ -85,6 +85,7 @@ def test_cluster_expansion( setup_logwriter_rbd_workload_factory, logreader_workload_factory, iterations, + cnv_workload, ): """ Test cluster exapnsion and health when add capacity is performed @@ -107,6 +108,13 @@ def test_cluster_expansion( ) logger.info("All the workloads pods are successfully up and running") + # setup vm and write some data to the VM instance + vm_obj = cnv_workload(volume_interface=constants.VM_VOLUME_PVC)[0] + vm_obj.run_ssh_cmd( + command="dd if=/dev/zero of=/file_1.txt bs=1024 count=102400" + ) + md5sum_before = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt") + start_time = datetime.now(timezone.utc) sc_obj.get_logfile_map(label=constants.LOGWRITER_CEPHFS_LABEL) @@ -123,6 +131,29 @@ def test_cluster_expansion( sc_obj.post_failure_checks(start_time, end_time, wait_for_read_completion=False) logger.info("Successfully verified with post failure checks for the workloads") + # check vm data written before the failure for integrity + md5sum_after = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt") + assert ( + md5sum_before == md5sum_after + ), "Data integrity of the file inside VM is not maintained during the add capacity" + logger.info( + "Data integrity of the file inside VM is maintained during the add capacity" + ) + + # check if new data can be created + vm_obj.run_ssh_cmd( + command="dd if=/dev/zero of=/file_2.txt bs=1024 count=103600" + ) + logger.info("Successfully created new data inside VM") + + # check if the data can be copied back to local machine + vm_obj.scp_from_vm(local_path="/tmp", vm_src_path="/file_1.txt") + logger.info("VM data is successfully copied back to local machine") + + # stop the VM + vm_obj.stop() + logger.info("Stoped the VM successfully") + sc_obj.cephfs_logreader_job.delete() logger.info(sc_obj.cephfs_logreader_pods) for pod in sc_obj.cephfs_logreader_pods: diff --git a/tests/functional/disaster-recovery/sc_arbiter/test_device_replacement.py b/tests/functional/disaster-recovery/sc_arbiter/test_device_replacement.py index b7002fdbccd..73a23645260 100644 --- a/tests/functional/disaster-recovery/sc_arbiter/test_device_replacement.py +++ b/tests/functional/disaster-recovery/sc_arbiter/test_device_replacement.py @@ -25,6 +25,8 @@ def test_device_replacement( setup_logwriter_cephfs_workload_factory, setup_logwriter_rbd_workload_factory, logreader_workload_factory, + cnv_workload, + setup_cnv, ): """ Test device replacement in stretch cluster while logwriter workload @@ -53,6 +55,13 @@ def test_device_replacement( ) logger.info("All the workloads pods are successfully up and running") + # setup vm and write some data to the VM instance + vm_obj = cnv_workload(volume_interface=constants.VM_VOLUME_PVC)[0] + vm_obj.run_ssh_cmd( + command="dd if=/dev/zero of=/file_1.txt bs=1024 count=102400" + ) + md5sum_before = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt") + start_time = datetime.now(timezone.utc) sc_obj.get_logfile_map(label=constants.LOGWRITER_CEPHFS_LABEL) @@ -67,6 +76,29 @@ def test_device_replacement( sc_obj.post_failure_checks(start_time, end_time, wait_for_read_completion=False) logger.info("Successfully verified with post failure checks for the workloads") + # check vm data written before the failure for integrity + md5sum_after = vm_obj.run_ssh_cmd(command="md5sum /file_1.txt") + assert ( + md5sum_before == md5sum_after + ), "Data integrity of the file inside VM is not maintained during the device replacement" + logger.info( + "Data integrity of the file inside VM is maintained during the device replacement" + ) + + # check if new data can be created + vm_obj.run_ssh_cmd( + command="dd if=/dev/zero of=/file_2.txt bs=1024 count=103600" + ) + logger.info("Successfully created new data inside VM") + + # check if the data can be copied back to local machine + vm_obj.scp_from_vm(local_path="/tmp", vm_src_path="/file_1.txt") + logger.info("VM data is successfully copied back to local machine") + + # stop the VM + vm_obj.stop() + logger.info("Stoped the VM successfully") + sc_obj.cephfs_logreader_job.delete() logger.info(sc_obj.cephfs_logreader_pods) for pod in sc_obj.cephfs_logreader_pods: