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>
(cherry picked from commit 2614cb5)

# Conflicts:
#	testing/integration/testdata/.upgrade-test-agent-versions.yml
#	testing/upgradetest/versions.go
  • Loading branch information
michalpristas authored and mergify[bot] committed Feb 25, 2025
1 parent 01fadd4 commit 42befb6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
6 changes: 6 additions & 0 deletions testing/integration/testdata/.upgrade-test-agent-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# upgrade integration tests.

testVersions:
<<<<<<< HEAD
=======
- 9.0.0-SNAPSHOT
- 8.19.0-SNAPSHOT
- 8.17.2
>>>>>>> 2614cb516 (Fix selection of testing version (#6578))
- 8.16.4
- 8.15.5
- 8.14.3
Expand Down
27 changes: 26 additions & 1 deletion testing/upgradetest/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,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 Down Expand Up @@ -211,15 +212,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 All @@ -240,6 +244,27 @@ func PreviousMinor() (*version.ParsedSemVer, error) {
if err != nil {
return nil, fmt.Errorf("failed to parse the current version %s: %w", define.Version(), err)
}
<<<<<<< HEAD

Check failure on line 247 in testing/upgradetest/versions.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

expected statement, found '<<' (typecheck)
=======

// Special case: if we are in the first release of a new major (so vX.0.0), we should
// return the latest release from the previous major.
if current.Minor() == 0 && current.Patch() == 0 {
// Since the current version is the first release of a new major (vX.0.0), there
// will be no minor versions in the versions list from the same major (vX). The list
// 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.
for _, v := range versions {
if v.Less(*current) {
return v, nil
}
}

return nil, ErrNoPreviousMinor
}

>>>>>>> 2614cb516 (Fix selection of testing version (#6578))

Check failure on line 267 in testing/upgradetest/versions.go

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

expected statement, found '>>' (typecheck)
for _, v := range versions {
if v.Prerelease() != "" || v.BuildMetadata() != "" {
continue
Expand Down

0 comments on commit 42befb6

Please # to comment.