diff --git a/ocs_ci/ocs/dr/dr_workload.py b/ocs_ci/ocs/dr/dr_workload.py index 64a5553c92f..fde1c438f8e 100644 --- a/ocs_ci/ocs/dr/dr_workload.py +++ b/ocs_ci/ocs/dr/dr_workload.py @@ -25,11 +25,12 @@ CommandFailed, UnexpectedBehaviour, ResourceNotDeleted, + ResourceWrongStatusException, ) from ocs_ci.ocs.resources.pod import get_all_pods from ocs_ci.ocs.utils import get_primary_cluster_config, get_non_acm_cluster_config from ocs_ci.utility import templating -from ocs_ci.utility.utils import clone_repo, run_cmd +from ocs_ci.utility.utils import clone_repo, run_cmd, TimeoutSampler log = logging.getLogger(__name__) @@ -614,13 +615,26 @@ def verify_workload_deployment(self): ) if self.appset_model == "pull": - appset_pull_obj = ocp.OCP( - kind=constants.APPLICATION_ARGOCD, - resource_name=appset_resource_name, - namespace=constants.GITOPS_CLUSTER_NAMESPACE, + sampler = TimeoutSampler( + 120, sleep=5, func=self.check_workload_health_status ) - appset_pull_obj._has_phase = True - appset_pull_obj.wait_for_phase(phase="Succeeded", timeout=120) + if not sampler.wait_for_func_status(True): + raise ResourceWrongStatusException( + f"{appset_resource_name} health status is not Healthy" + ) + + def check_workload_health_status(self): + appset_resource_name = ( + self._get_applicaionset_name() + "-" + self.preferred_primary_cluster + ) + appset_obj = ocp.OCP( + kind=constants.APPLICATION_ARGOCD, + resource_name=appset_resource_name, + namespace=constants.GITOPS_CLUSTER_NAMESPACE, + ) + health_status = appset_obj.get().get("status").get("health").get("status") + log.info(f"{appset_resource_name} health status: {health_status}") + return health_status == "Healthy" def check_pod_pvc_status(self, skip_replication_resources=False): """