Skip to content

Commit c68ed3f

Browse files
authored
Handle agent UI driven install cluster install page properly (#1837)
The transition from the cluster-install page to the operator page often fails, particularly for version 4.21 and later. Add a wait and retry to ensure that the cluster install has started properly.
1 parent b688e9d commit c68ed3f

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

  • agent/isobuilder/ui_driven_cluster_installation

agent/isobuilder/ui_driven_cluster_installation/main.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ func main() {
6363

6464
next(page)
6565

66+
// Wait for page to load and check if cluster creation completed in time
67+
logrus.Info("Waiting for operators page to load...")
68+
time.Sleep(3 * time.Second)
69+
70+
// Check if we got an error page because cluster wasn't created in time
71+
errorMsg, _ := page.Timeout(2 * time.Second).ElementR("div", "Cluster details not found")
72+
if errorMsg != nil {
73+
logrus.Info("Cluster not ready yet, waiting and reloading...")
74+
// Wait longer for cluster creation to complete
75+
time.Sleep(5 * time.Second)
76+
// Reload the page
77+
page.MustReload()
78+
page.MustWaitLoad()
79+
logrus.Info("Page reloaded, continuing...")
80+
}
81+
6682
logrus.Info("Select virtualization bundle")
6783
err = virtualizationBundle(page, filepath.Join(screenshotPath, "02-operators.png"))
6884
if err != nil {
@@ -130,6 +146,10 @@ func clusterDetails(page *rod.Page, path string) error {
130146
pullSecret := strings.TrimSpace(string(secretBytes))
131147
page.MustElement("#form-input-pullSecret-field").MustInput(pullSecret)
132148

149+
// Allow UI enough time to complete the background API call to create the cluster
150+
time.Sleep(2 * time.Second)
151+
page.MustElement("button[name='next']").MustWaitEnabled()
152+
133153
err = saveFullPageScreenshot(page, path)
134154
if err != nil {
135155
return err
@@ -312,6 +332,10 @@ func getClusterID(client *resty.Client, url string) (string, error) {
312332
return "", err
313333
}
314334

335+
if len(clusters) == 0 {
336+
return "", fmt.Errorf("no clusters found")
337+
}
338+
315339
return clusters[0].ID, nil
316340
}
317341

0 commit comments

Comments
 (0)