Skip to content

Commit

Permalink
Check for Kube Object Sync time before running failover for Discovere…
Browse files Browse the repository at this point in the history
…d Apps

Signed-off-by: prsurve <prsurve@redhat.com>
  • Loading branch information
prsurve committed Oct 7, 2024
1 parent 911d79b commit 937140c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ocs_ci/helpers/dr_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ def verify_last_kubeobject_protection_time(drpc_obj, kubeoject_sync_interval):
).total_seconds() / 60
logger.info(f"Time in minutes since the last sync {time_since_last_sync}")
assert (
time_since_last_sync < 3 * kubeoject_sync_interval
time_since_last_sync < 2 * kubeoject_sync_interval
), "The syncing of Kube Resources is exceeding three times the Kube object sync interval"
logger.info("Verified lastKubeObjectProtectionTime value within expected range")
config.switch_ctx(restore_index)
Expand Down
3 changes: 2 additions & 1 deletion ocs_ci/ocs/dr/dr_workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,8 @@ def __init__(self, **kwargs):
self.discovered_apps_placement_name = kwargs.get("workload_placement_name")
self.drpc_yaml_file = os.path.join(constants.DRPC_PATH)
self.placement_yaml_file = os.path.join(constants.PLACEMENT_PATH)
self.kubeobject_capture_interval = f"{generate_kubeobject_capture_interval()}m"
self.kubeobject_capture_interval_int = generate_kubeobject_capture_interval()
self.kubeobject_capture_interval = f"{self.kubeobject_capture_interval_int}m"
self.protection_type = kwargs.get("protection_type")
self.target_clone_dir = config.ENV_DATA.get(
"target_clone_dir", constants.DR_WORKLOAD_REPO_BASE_DIR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ocs_ci.framework.testlib import acceptance, tier1
from ocs_ci.framework.pytest_customization.marks import turquoise_squad
from ocs_ci.helpers import dr_helpers
from ocs_ci.ocs import constants
from ocs_ci.ocs.resources.drpc import DRPC

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -44,14 +45,14 @@ def test_failover_and_relocate_discovered_apps(self, discovered_apps_dr_workload
scheduling_interval = dr_helpers.get_scheduling_interval(
rdr_workload.workload_namespace, discovered_apps=True
)
drpc_obj = DRPC(namespace=rdr_workload.workload_namespace)
drpc_obj = DRPC(namespace=constants.DR_OPS_NAMESAPCE)
wait_time = 2 * scheduling_interval # Time in minutes
logger.info(f"Waiting for {wait_time} minutes to run IOs")
sleep(wait_time * 60)

logger.info("Checking for lastKubeObjectProtectionTime")
dr_helpers.verify_last_kubeobject_protection_time(
drpc_obj, rdr_workload.kubeobject_capture_interval
drpc_obj, rdr_workload.kubeobject_capture_interval_int
)

dr_helpers.failover(
Expand Down

0 comments on commit 937140c

Please sign in to comment.