Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
keemano committed Oct 10, 2024
1 parent b2162a7 commit aac4b61
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
11 changes: 11 additions & 0 deletions ocs_ci/helpers/dr_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
35 changes: 25 additions & 10 deletions tests/functional/disaster-recovery/regional-dr/test_disable_dr.py
Original file line number Diff line number Diff line change
@@ -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__)

Expand Down Expand Up @@ -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,
Expand All @@ -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()

Expand All @@ -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"

0 comments on commit aac4b61

Please sign in to comment.