From 5a75db3a69c596097b1e5313f3121afca086b19b Mon Sep 17 00:00:00 2001 From: Mahesh Shetty Date: Mon, 16 Dec 2024 18:06:58 +0530 Subject: [PATCH] Address review comments Signed-off-by: Mahesh Shetty --- .../sc_arbiter/test_mon_osd_failures.py | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) 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 4adb635addc..08ff761150b 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 @@ -20,6 +20,8 @@ wait_for_pods_to_be_in_statuses, get_deployment_name, wait_for_pods_by_label_count, + get_all_pods, + get_pod_node, ) from ocs_ci.ocs.resources.pvc import get_pvc_objs from ocs_ci.ocs.resources.stretchcluster import StretchCluster @@ -27,6 +29,8 @@ logger = logging.getLogger(__name__) +CNV_WORKLOAD_NAMESPACE = "namespace-cnv-workload" + @pytest.fixture(scope="class") def setup_logwriter_workloads( @@ -141,7 +145,9 @@ def finalizer(): def setup_cnv_workload(request, cnv_workload_class, setup_cnv): logger.info("Setting up CNV workload and creating some data") - vm_obj = cnv_workload_class(volume_interface=constants.VM_VOLUME_PVC)[0] + vm_obj = cnv_workload_class( + volume_interface=constants.VM_VOLUME_PVC, namespace=CNV_WORKLOAD_NAMESPACE + )[0] vm_obj.run_ssh_cmd(command="dd if=/dev/zero of=/file_1.txt bs=1024 count=102400") md5sum_before = cal_md5sum_vm(vm_obj, file_path="/file_1.txt") @@ -198,8 +204,14 @@ def test_single_mon_failures(self): logger.info("testing single mon failures scenario") sc_obj = StretchCluster() - # get mon-pod of a single zone - mon_pods_in_zone = sc_obj.get_mon_pods_in_a_zone("data-1") + # get mon-pod of a zone where the cnv workloads + # are running + pod_objs = get_all_pods(namespace=CNV_WORKLOAD_NAMESPACE) + assert len(pod_objs) != 0, "No vmi pod instances are running" + node_obj = get_pod_node(pod_objs[0]) + mon_pods_in_zone = sc_obj.get_mon_pods_in_a_zone( + node_obj.get()["metadata"]["labels"][constants.ZONE_LABEL] + ) mon_pod_to_fail = random.choice(mon_pods_in_zone).name # get the deployment of the mon-pod @@ -267,8 +279,14 @@ def test_single_osd_failure(self): logger.info("testing single osd failure scenarios") sc_obj = StretchCluster() - # get osd-pod of a single zone - osd_pods_in_zone = sc_obj.get_osd_pods_in_a_zone("data-1") + # get osd-pod of a zone where the cnv + # workloads are running + pod_objs = get_all_pods(namespace=CNV_WORKLOAD_NAMESPACE) + assert len(pod_objs) != 0, "No vmi pod instances are running" + node_obj = get_pod_node(pod_objs[0]) + osd_pods_in_zone = sc_obj.get_osd_pods_in_a_zone( + node_obj.get()["metadata"]["labels"][constants.ZONE_LABEL] + ) osd_pod_to_fail = random.choice(osd_pods_in_zone).name # get the deployment of the osd-pod