Skip to content

Commit

Permalink
Sort machineCRD.Spec.Versions before itearting
Browse files Browse the repository at this point in the history
  • Loading branch information
furkatgofurov7 committed Aug 10, 2023
1 parent 4db8bf6 commit 14eee8a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/e2e/clusterctl_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"
"path/filepath"
"runtime"
"sort"
"strings"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -400,6 +401,11 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
Kind: machineCRD.Spec.Names.ListKind,
}

// Sort the machineCRD.Spec.Versions slice
sort.Slice(machineCRD.Spec.Versions, func(i, j int) bool {
return machineCRD.Spec.Versions[i].Name < machineCRD.Spec.Versions[j].Name
})

// Pick the first served version
for _, gvk := range machineCRD.Spec.Versions {
if gvk.Served {
Expand Down

0 comments on commit 14eee8a

Please sign in to comment.