From a24365d4bf748e2f85c9f04d84cbeac89c711cf9 Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Tue, 25 Feb 2025 21:06:31 +0100 Subject: [PATCH 1/2] Fix selection of testing version (#6578) * mark and skip flaky TestOTelManager_Run * updated test version selection * Update testing/upgradetest/versions.go Co-authored-by: Craig MacKenzie * 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 Co-authored-by: Panos Koutsovasilis (cherry picked from commit 2614cb516c223311e10d9243fb758b76defbf975) --- .../testdata/.upgrade-test-agent-versions.yml | 2 +- testing/upgradetest/versions.go | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/testing/integration/testdata/.upgrade-test-agent-versions.yml b/testing/integration/testdata/.upgrade-test-agent-versions.yml index 550aa561b49..96cba951c3e 100644 --- a/testing/integration/testdata/.upgrade-test-agent-versions.yml +++ b/testing/integration/testdata/.upgrade-test-agent-versions.yml @@ -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 diff --git a/testing/upgradetest/versions.go b/testing/upgradetest/versions.go index ff13ac18ebc..9be4854028f 100644 --- a/testing/upgradetest/versions.go +++ b/testing/upgradetest/versions.go @@ -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 @@ -214,7 +215,7 @@ 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-- @@ -222,7 +223,10 @@ func findRequiredVersions(sortedParsedVersions []*version.ParsedSemVer, reqs Ver 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: @@ -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 { From c1e0cf02e493e8f6754eeaee553ee3c9fe1b8bcf Mon Sep 17 00:00:00 2001 From: Panos Koutsovasilis Date: Tue, 25 Feb 2025 22:12:50 +0200 Subject: [PATCH 2/2] revert .upgrade-test-agent-versions.yml changes --- testing/integration/testdata/.upgrade-test-agent-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/integration/testdata/.upgrade-test-agent-versions.yml b/testing/integration/testdata/.upgrade-test-agent-versions.yml index 96cba951c3e..550aa561b49 100644 --- a/testing/integration/testdata/.upgrade-test-agent-versions.yml +++ b/testing/integration/testdata/.upgrade-test-agent-versions.yml @@ -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