diff --git a/ocs_ci/helpers/dr_helpers.py b/ocs_ci/helpers/dr_helpers.py index 14cb63addd2..32a6c96a1b7 100644 --- a/ocs_ci/helpers/dr_helpers.py +++ b/ocs_ci/helpers/dr_helpers.py @@ -1699,6 +1699,17 @@ def disable_dr_rdr(): @retry(CommandFailed, tries=10, delay=30, backoff=1) def verify_drpc_deletion(cmd, expected_output_lst): + """ + Function to validate drpc deletion + + Args: + cmd(str): cli command + expected_output_lst(set): A set of strings that need to be included in the command output. + + Returns: + bool: True, if all strings are included in the command output, False otherwise. + + """ drpc_out = exec_cmd(cmd) for expected_output in expected_output_lst: if expected_output not in drpc_out.stderr.decode(): diff --git a/tests/functional/disaster-recovery/regional-dr/test_disable_dr.py b/tests/functional/disaster-recovery/regional-dr/test_disable_dr.py index 49240e2bf99..fd1b2eb9b0e 100644 --- a/tests/functional/disaster-recovery/regional-dr/test_disable_dr.py +++ b/tests/functional/disaster-recovery/regional-dr/test_disable_dr.py @@ -1,13 +1,14 @@ import logging -from time import sleep import pytest +from time import sleep from ocs_ci.framework import config from ocs_ci.framework.testlib import tier1 from ocs_ci.framework.pytest_customization.marks import turquoise_squad from ocs_ci.helpers import dr_helpers -from ocs_ci.ocs.resources.pod import check_pods_in_statuses from ocs_ci.ocs import constants +from ocs_ci.ocs.resources.drpc import DRPC + logger = logging.getLogger(__name__) @@ -42,10 +43,12 @@ def test_disable_dr(self, pvc_interface, dr_workload): rdr_workload = dr_workload( num_of_subscription=1, num_of_appset=1, pvc_interface=pvc_interface ) - - primary_cluster_name = dr_helpers.get_current_primary_cluster_name( - rdr_workload[0].workload_namespace, + drpc_subscription = DRPC(namespace=rdr_workload[0].workload_namespace) + drpc_appset = DRPC( + namespace=constants.GITOPS_CLUSTER_NAMESPACE, + resource_name=f"{rdr_workload[1].appset_placement_name}-drpc", ) + drpc_objs = [drpc_subscription, drpc_appset] scheduling_interval = dr_helpers.get_scheduling_interval( rdr_workload[0].workload_namespace, @@ -54,6 +57,16 @@ def test_disable_dr(self, pvc_interface, dr_workload): logger.info(f"Waiting for {wait_time} minutes to run IOs") sleep(wait_time * 60) + # Check lastGroupSyncTime + for drpc_obj in drpc_objs: + dr_helpers.verify_last_group_sync_time(drpc_obj, scheduling_interval) + + logger.info("Verified the lastGroupSyncTime before disabling the DR") + + primary_cluster_name = dr_helpers.get_current_primary_cluster_name( + rdr_workload[0].workload_namespace, + ) + # Disable DR dr_helpers.disable_dr_rdr() @@ -72,9 +85,11 @@ def test_disable_dr(self, pvc_interface, dr_workload): ) # Verify pod status on primary cluster logger.info( - f"Wait for all the pods in {workload.workload_namespace} to be in running state" + f"Validate pods and pvc in {workload.workload_namespace} be in Running state" + ) + dr_helpers.wait_for_all_resources_creation( + workload.workload_pvc_count, + workload.workload_pod_count, + workload.workload_namespace, + skip_replication_resources=True, ) - assert check_pods_in_statuses( - expected_statuses="Running", - namespace=workload.workload_namespace, - ), "Not all the pods in running state"