Skip to content

Commit 3684fb2

Browse files
committed
OCM-15511 | ci: Use cluster spec to check the ready and waiting status in the Day1Readiness step
1 parent 4f425f6 commit 3684fb2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/utils/exec/rosacli/cluster_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,11 @@ func (c *clusterService) WaitForClusterPassUninstalled(clusterID string, interva
506506
func (c *clusterService) WaitForClusterPassWaiting(clusterID string, interval int, timeoutMin int) error {
507507
endTime := time.Now().Add(time.Duration(timeoutMin) * time.Minute)
508508
for time.Now().Before(endTime) {
509-
output, err := c.DescribeClusterAndReflect(clusterID)
509+
clusterJsonData, err := c.GetJSONClusterDescription(clusterID)
510510
if err != nil {
511511
return err
512512
}
513-
if !strings.Contains(output.State, constants.Waiting) {
513+
if clusterJsonData.DigString("state") != constants.Waiting {
514514
log.Logger.Infof("Cluster %s is not in waiting state anymore", clusterID)
515515
return nil
516516
}

tests/utils/handler/cluster_handler.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,11 @@ func (ch *clusterHandler) WaitForClusterReady(timeoutMin int) error {
878878
endTime := time.Now().Add(time.Duration(timeoutMin) * time.Minute)
879879
sleepTime := 0
880880
for time.Now().Before(endTime) {
881+
clusterJsonData, _ := clusterService.GetJSONClusterDescription(clusterID)
882+
if clusterJsonData.DigString("state") == constants.Ready {
883+
log.Logger.Infof("Cluster %s is ready now.", clusterID)
884+
return nil
885+
}
881886
description, err := clusterService.DescribeClusterAndReflect(clusterID)
882887
if err != nil {
883888
return err
@@ -886,9 +891,6 @@ func (ch *clusterHandler) WaitForClusterReady(timeoutMin int) error {
886891
ch.clusterDetail.ConsoleURL = description.ConsoleURL
887892
ch.clusterDetail.InfraID = description.InfraID
888893
switch description.State {
889-
case constants.Ready:
890-
log.Logger.Infof("Cluster %s is ready now.", clusterID)
891-
return nil
892894
case constants.Uninstalling:
893895
return fmt.Errorf("cluster %s is %s now. Cannot wait for it ready",
894896
clusterID, constants.Uninstalling)

0 commit comments

Comments
 (0)