From ba9ffbbfe932ba8c76352b12bfb09a68c19b54a5 Mon Sep 17 00:00:00 2001 From: Mahesh Shetty Date: Mon, 21 Oct 2024 18:21:18 +0530 Subject: [PATCH] Add cnv workload to mon & osd failure test Signed-off-by: Mahesh Shetty --- .../sc_arbiter/test_mon_osd_failures.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/functional/disaster-recovery/sc_arbiter/test_mon_osd_failures.py b/tests/functional/disaster-recovery/sc_arbiter/test_mon_osd_failures.py index 8576bc54f38a..545a713df44a 100644 --- a/tests/functional/disaster-recovery/sc_arbiter/test_mon_osd_failures.py +++ b/tests/functional/disaster-recovery/sc_arbiter/test_mon_osd_failures.py @@ -136,8 +136,47 @@ def finalizer(): request.addfinalizer(finalizer) +@pytest.fixture(scope="class") +def setup_cnv_workload(request, cnv_workload, setup_cnv): + + logger.info("Setting up CNV workload and creating some data") + 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") + + def finalizer(): + + # check vm data written before the failure for integrity + logger.info("Waiting for VM SSH connectivity!") + vm_obj.wait_for_ssh_connectivity() + 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 failure" + logger.info( + "Data integrity of the file inside VM is maintained during the failure" + ) + + # 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") + + request.addfinalizer(finalizer) + + @turquoise_squad @stretchcluster_required +@pytest.mark.usefixtures("setup_cnv_workload") @pytest.mark.usefixtures("setup_logwriter_workloads") class TestMonAndOSDFailures: """