Skip to content

Commit

Permalink
Add the sleep param to the function 'wait_for_nodes_status' (#9267)
Browse files Browse the repository at this point in the history
Signed-off-by: Itzhak Kave <[email protected]>
Co-authored-by: Itzhak Kave <[email protected]>
  • Loading branch information
yitzhak12 and Itzhak Kave authored Feb 1, 2024
1 parent e6fb2b7 commit c73d931
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ocs_ci/ocs/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ def get_all_nodes():
return [node["metadata"]["name"] for node in node_items]


def wait_for_nodes_status(node_names=None, status=constants.NODE_READY, timeout=180):
def wait_for_nodes_status(
node_names=None, status=constants.NODE_READY, timeout=180, sleep=3
):
"""
Wait until all nodes are in the given status
Expand All @@ -160,6 +162,7 @@ def wait_for_nodes_status(node_names=None, status=constants.NODE_READY, timeout=
(e.g. 'Ready', 'NotReady', 'SchedulingDisabled')
timeout (int): The number in seconds to wait for the nodes to reach
the status
sleep (int): Time in seconds to sleep between attempts
Raises:
ResourceWrongStatusException: In case one or more nodes haven't
Expand All @@ -174,7 +177,7 @@ def wait_for_nodes_status(node_names=None, status=constants.NODE_READY, timeout=
break
nodes_not_in_state = copy.deepcopy(node_names)
log.info(f"Waiting for nodes {node_names} to reach status {status}")
for sample in TimeoutSampler(timeout, 3, get_node_objs, nodes_not_in_state):
for sample in TimeoutSampler(timeout, sleep, get_node_objs, nodes_not_in_state):
for node in sample:
try:
if node.ocp.get_resource_status(node.name) == status:
Expand Down

0 comments on commit c73d931

Please sign in to comment.