Skip to content

Commit

Permalink
Fix selection of testing version (#6578)
Browse files Browse the repository at this point in the history
* mark and skip flaky TestOTelManager_Run

* updated test version selection

* Update testing/upgradetest/versions.go

Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>

* updated versions

* pin 9.0

* pin 9.0

* removed version pin for 9.0

* Update magefile.go

* updated branches

* fix previousMinor for pinned 9.0

---------

Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
  • Loading branch information
3 people authored Feb 25, 2025
1 parent c356857 commit 2614cb5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# upgrade integration tests.

testVersions:
- 9.0.0-SNAPSHOT
- 8.19.0-SNAPSHOT
- 8.18.0-SNAPSHOT
- 8.17.2
- 8.16.4
- 7.17.28-SNAPSHOT
14 changes: 12 additions & 2 deletions testing/upgradetest/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ func findRequiredVersions(sortedParsedVersions []*version.ParsedSemVer, reqs Ver
currentMajor := parsedUpgradeToVersion.Major()
currentMinor := parsedUpgradeToVersion.Minor()

skipCurrentMajor := false
currentMajorsToFind := reqs.CurrentMajors
previousMajorsToFind := reqs.PreviousMajors
previousMinorsToFind := reqs.PreviousMinors
Expand All @@ -214,15 +215,18 @@ func findRequiredVersions(sortedParsedVersions []*version.ParsedSemVer, reqs Ver
currentMajorsToFind-- // counts as the current major as well

// current majors
case currentMajorsToFind > 0 && version.Major() == currentMajor:
case currentMajorsToFind > 0 && version.Major() == currentMajor && !skipCurrentMajor:
upgradableVersions = append(upgradableVersions, version.String())
currentMajorsToFind--

// previous majors
case previousMajorsToFind > 0 && version.Major() < currentMajor:
upgradableVersions = append(upgradableVersions, version.String())
currentMajor = version.Major()
currentMinor = version.Minor()
previousMajorsToFind--
previousMinorsToFind-- // count as prev minor as well
skipCurrentMajor = true

// since the list is sorted we can stop here
default:
Expand Down Expand Up @@ -252,7 +256,13 @@ func PreviousMinor() (*version.ParsedSemVer, error) {
// will only contain minors from the previous major (vX-1). Further, since the
// version list is sorted in descending order (newer versions first), we can return the
// first item from the list as it will be the newest minor of the previous major.
return versions[0], nil
for _, v := range versions {
if v.Less(*current) {
return v, nil
}
}

return nil, ErrNoPreviousMinor
}

for _, v := range versions {
Expand Down

0 comments on commit 2614cb5

Please # to comment.