Skip to content

Commit

Permalink
tests: choose latest y-stream versioning for rhcos upgrade
Browse files Browse the repository at this point in the history
The cincinatti graph is used to determine the latest OCP release. It
was assumed that only the latest node would have no upgrade path in
the graph but that is not the case. When upgrades are blocked, there
can be two nodes that no have upgrade path. We need to choose the
newest one in the upgrade test.
  • Loading branch information
mike-nguyen committed Dec 7, 2022
1 parent c64b6d7 commit 5859133
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion mantle/kola/tests/rhcos/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
cosa "github.com/coreos/coreos-assembler/pkg/builds"
coreosarch "github.com/coreos/stream-metadata-go/arch"

"github.com/coreos/go-semver/semver"
"github.com/coreos/mantle/kola"
"github.com/coreos/mantle/kola/cluster"
"github.com/coreos/mantle/kola/register"
Expand Down Expand Up @@ -358,8 +359,23 @@ func downloadLatestReleasedRHCOS(target string) (string, error) {
return
}(releaseIndex, unique)

// In cases where there is a blocked upgrade to a new Y-stream there can be
// two nodes that don't have an edge to upgrade to. This is generally the
// latest 4.Y-1.Z and the latest 4.Y.Z. Choose the latest 4.Y.Z
latest := difference[0]
if len(difference) == 2 {
vA := semver.New(graph.Nodes[difference[0]].Version)
vB := semver.New(graph.Nodes[difference[1]].Version)

if vA.LessThan(*vB) {
latest = difference[1]
} else {
latest = difference[0]
}
}

var ocpRelease *OcpRelease
latestOcpPayload := graph.Nodes[difference[0]].Payload
latestOcpPayload := graph.Nodes[latest].Payload
// oc should be included in cosa since https://github.com/coreos/coreos-assembler/pull/2777
cmd := exec.Command("/usr/bin/oc", "adm", "release", "info", latestOcpPayload, "-o", "json")
output, err := cmd.Output()
Expand Down

0 comments on commit 5859133

Please sign in to comment.