-
Notifications
You must be signed in to change notification settings - Fork 249
ROSAENG-61038 | fix: improve ready-state cluster waiting #3327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
olucasfreitas
wants to merge
1
commit into
openshift:master
Choose a base branch
from
olucasfreitas:cursor/b2edb6ff
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+438
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review is for all status/state comparisons: should the code use case-insensitive comparison if OCM state casing can vary? Exact match on "ready" today.
@coderabbitai validate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 6444
@amandahlaConfirmed — I checkedtests/utils/constants/cluster.go, and all the state constants used in these comparisons (Ready = "ready",Waiting = "waiting",Error = "error",Uninstalling = "uninstalling", etc.) are lowercase, and the OCMstatefield returned byrosa describe cluster(both JSON and table output) is consistently lowercase as well. So the exact-match comparisons (description.State == constants.Ready,clusterItem.State == status,clusterJSONData.DigString("state"), etc.) work correctly today because both sides follow the same lowercase convention — it's not a correctness bug currently.That said, since this is test/e2e tooling parsing CLI text output (which is inherently more fragile than a typed API response), I agree it's worth hardening defensively:
strings.EqualFold(description.State, constants.Ready)instead of==for state comparisons.strings.Contains(strings.ToLower(description.State), constants.Uninstalling)(orstrings.EqualFold-based helper) for theUninstalling/Errorsubstring checks.WaitForClusterPassWaiting's!= constants.Waitingcheck.This would guard against any future casing changes in OCM's state values or unexpected CLI formatting drift, at negligible cost. Let me know if you'd like me to kick off a plan for this change, or if you'd prefer to leave it as exact-match since it matches current OCM behavior.
🧬 Code Graph Analysis Results
Relevant snippet(s)
tests/utils/exec/rosacli/cluster_service.go(approx. lines 230-320): status/state comparisons inWaitClusterStatustests/utils/exec/rosacli/cluster_service.go(approx. lines 322-386):constants.Readyexact match inwaitForClusterReadyStatustests/utils/exec/rosacli/cluster_service.go(approx. lines 388-450): state comparisons inevaluateReadyClusterStatetests/utils/exec/rosacli/cluster_service.go(approx. lines 470-530):constants.Waitingexact match inWaitForClusterPassWaitingtests/utils/exec/rosacli/cluster_service.go(approx. lines 440-470): uninstalling state matching viastrings.ContainsinWaitForClusterPassUninstalledtests/utils/constants/cluster.go(lines 34-39): canonical state string constantsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked this one against the current test contract before changing it.
tests/utils/constants/cluster.goand the CLI/OCM state strings we parse are all lowercase today, so I left the comparisons exact in this patch. If we ever see mixed-case state output, I would rather normalize once at the parse boundary and add a focused regression test than broaden each comparison independently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.