Skip to content

Commit 5008147

Browse files
committed
Wait for dsc and dsci ready state in cluster_sanity check (opendatahub-io#293)
1 parent 781f8a4 commit 5008147

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

utilities/infra.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,21 @@ def wait_for_dsci_status_ready(dsci_resource: DSCInitialization) -> bool:
877877
)
878878

879879

880+
@retry(
881+
wait_timeout=120,
882+
sleep=5,
883+
exceptions_dict={ResourceNotReadyError: []},
884+
)
885+
def wait_for_dsci_status_ready(dsci_resource: DSCInitialization) -> bool:
886+
LOGGER.info(f"Wait for DSCI {dsci_resource.name} to be in {dsci_resource.Status.READY} status.")
887+
if dsci_resource.status == dsci_resource.Status.READY:
888+
return True
889+
890+
raise ResourceNotReadyError(
891+
f"DSCI {dsci_resource.name} is not ready.\nCurrent status: {dsci_resource.instance.status}"
892+
)
893+
894+
880895
@retry(
881896
wait_timeout=120,
882897
sleep=5,
@@ -929,7 +944,6 @@ def verify_cluster_sanity(
929944
wait_for_dsci_status_ready(dsci_resource=dsci_resource)
930945
wait_for_dsc_status_ready(dsc_resource=dsc_resource)
931946

932-
933947
except (ResourceNotReadyError, NodeUnschedulableError, NodeNotReadyError) as ex:
934948
error_msg = f"Cluster sanity check failed: {str(ex)}"
935949
# return_code set to 99 to not collide with https://docs.pytest.org/en/stable/reference/exit-codes.html

0 commit comments

Comments
 (0)