Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openshift/tests-extension/test/qe/specs/olmv1_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
g.By("check if Upgradeable status is false")
errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) {
message, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`)
if strings.Contains(message, expectedPattern) && strings.Contains(message, "5") {
if strings.Contains(message, expectedPattern) {
e2e.Logf("message:%s", message)
return true, nil
}
Expand Down
18 changes: 11 additions & 7 deletions openshift/tests-extension/test/qe/util/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,18 +547,21 @@ func PatchResource(oc *CLI, asAdmin bool, withoutNamespace bool, parameters ...s
o.Expect(err).NotTo(o.HaveOccurred())
}

// GetNextMinorVersion calculates the next minor version string from the current cluster version
// GetNextMinorVersion calculates the next minor version string from the current cluster version.
// Parameters:
// - oc: CLI client for interacting with the OpenShift cluster
//
// Returns:
// - string: next minor version in "MAJOR.MINOR" format (e.g., "4.23")
// - string: next minor version in "MAJOR.MINOR" format (e.g., "5.1")
// - error: error if version retrieval or calculation fails, nil on success
//
// Example:
//
// nextVersion, err := GetNextMinorVersion(oc)
// // For cluster version "4.22.0-xxx", returns: "4.23", nil
// // For cluster version "5.0.0-xxx", returns: "5.1", nil
//
// Special case: OCP 4.23 and 5.0 are co-released equivalents; the only upgrade target
// from either is 5.1. A cluster at 4.23 therefore returns "5.1", not "4.24".
func GetNextMinorVersion(oc *CLI) (string, error) {
if oc == nil {
return "", fmt.Errorf("CLI client cannot be nil")
Expand Down Expand Up @@ -587,9 +590,10 @@ func GetNextMinorVersion(oc *CLI) (string, error) {
return "", fmt.Errorf("failed to parse minor version from %s: %w", parts[1], err)
}

// Calculate next minor version
nextMinor := minor + 1
nextVersion := fmt.Sprintf("%d.%d", major, nextMinor)
// OCP 4.23 and 5.0 are co-released equivalents; the only upgrade target from either is 5.1.
if major == 4 && minor == 23 {
return "5.1", nil
}

return nextVersion, nil
return fmt.Sprintf("%d.%d", major, minor+1), nil
}