Skip to content

Commit 851b88d

Browse files
hanwen-clusterhanwen-pcluste
authored andcommitted
[integ-tests] Add wait_cluster_status utility method
This method is required by 70b1f77. The commit was cherry-picked from develop branch, but missed to cherry pick wait_cluster_status Signed-off-by: Hanwen <hanwenli@amazon.com>
1 parent d676eeb commit 851b88d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/integration-tests/clusters_factory.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ def describe_cluster(self):
206206
logging.error("Failed when getting cluster status with error:\n%s\nand output:\n%s", e.stderr, e.stdout)
207207
raise
208208

209+
def wait_cluster_status(self, expected_status, stop_max_delay_minute=15):
210+
"""Wait for the cluster to reach the desired status."""
211+
retry(
212+
wait_fixed=seconds(10),
213+
stop_max_delay=minutes(stop_max_delay_minute),
214+
retry_on_result=lambda result: result["clusterStatus"] != expected_status,
215+
)(self.describe_cluster)()
216+
209217
def describe_compute_fleet(self):
210218
"""Run pcluster describe-compute-fleet and return the result."""
211219
cmd_args = ["pcluster", "describe-compute-fleet", "--cluster-name", self.name]

0 commit comments

Comments
 (0)