Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix selection of testing version #6578

Merged
merged 20 commits into from
Feb 25, 2025

Conversation

michalpristas
Copy link
Contributor

@michalpristas michalpristas commented Jan 23, 2025

SLightly changing algorithm to select test versions

with config

{
  "UpgradeToVersion": "9.0.0",
  "CurrentMajors": 1,
  "PreviousMajors": 1,
  "PreviousMinors": 2,
  "SnapshotBranches": [
    "8.x",
    "8.17",
    "7.17"
  ]
}

these available versions

-8.16.3
-8.17.1
-7.17.27
-8.16.2
-8.17.0
-7.17.26
-8.15.5
-8.16.1
-8.16.0
-8.15.4
-8.15.3+build202411051926
-7.17.25
-and so on

resolved to

before change:

  - 8.18.0-SNAPSHOT
  - 8.17.1
  - 8.17.1-SNAPSHOT
  - 8.17.0
  - 7.17.28-SNAPSHOT

after change:

  - 8.18.0-SNAPSHOT
  - 8.17.1
  - 8.17.1-SNAPSHOT
  - 8.16.3
  - 7.17.28-SNAPSHOT

as we wanted 1 previous major in case of target 9.0.0 it is 8.x
and 2 previous minors so out of 8.x we took latest patches for 8.17 and 8.16 as released ones

@michalpristas michalpristas self-assigned this Jan 23, 2025
@michalpristas michalpristas requested a review from a team as a code owner January 23, 2025 10:13
Copy link
Contributor

mergify bot commented Jan 23, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b fix-versions upstream/fix-versions
git merge upstream/main
git push upstream fix-versions

@swiatekm swiatekm added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Jan 23, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@michalpristas michalpristas requested a review from cmacknz January 23, 2025 10:24
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am probably missing something but I tried to validate this PR updating the TestFetchUpgradableVersionsAfterFeatureFreeze unit-test

Index: testing/upgradetest/versions_test.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/testing/upgradetest/versions_test.go b/testing/upgradetest/versions_test.go
--- a/testing/upgradetest/versions_test.go	(revision 584f0acdbec6b7a42be159242b375dcdf9883649)
+++ b/testing/upgradetest/versions_test.go	(date 1738220339468)
@@ -23,6 +23,10 @@
 		"7.17.16",
 		"7.17.17",
 		"7.17.18",
+		"7.17.25",
+		"7.17.26",
+		"7.17.27",
+		"7.17.28",
 		"8.9.2",
 		"8.10.0",
 		"8.10.1",
@@ -38,12 +42,25 @@
 		"8.12.1",
 		"8.12.2",
 		"8.13.0",
+		"8.14.0",
+		"8.15.3+build202411051926",
+		"8.15.4",
+		"8.15.5",
+		"8.16.0",
+		"8.16.1",
+		"8.16.2",
+		"8.16.3",
+		"8.17.0",
+		"8.17.1",
 	}
 	snapshotList = []string{
 		"7.17.19-SNAPSHOT",
+		"7.17.28-SNAPSHOT",
 		"8.12.2-SNAPSHOT",
 		"8.13.0-SNAPSHOT",
 		"8.14.0-SNAPSHOT",
+		"8.17.1-SNAPSHOT",
+		"8.18.0-SNAPSHOT",
 	}
 )
 
@@ -52,21 +69,19 @@
 	defer cancel()
 
 	expectedUpgradableVersions := []string{
-		"8.13.0-SNAPSHOT",
-		"8.12.2",
-		"8.12.2-SNAPSHOT",
-		"8.12.1",
-		"8.12.0",
-		"8.11.4",
-		"7.17.18",
+		"8.18.0-SNAPSHOT",
+		"8.17.1",
+		"8.17.1-SNAPSHOT",
+		"8.16.3",
+		"7.17.28-SNAPSHOT",
 	}
 
 	reqs := VersionRequirements{
-		UpgradeToVersion: "8.13.0",                 // to test that 8.14 is not returned
-		CurrentMajors:    3,                        // should return 8.12.2, 8.12.1, 8.12.0
-		PreviousMajors:   3,                        // should return 7.17.18
-		PreviousMinors:   2,                        // should return 8.12.2, 8.11.4
-		SnapshotBranches: []string{"8.13", "8.12"}, // should return 8.13.0-SNAPSHOT, 8.12.2-SNAPSHOT
+		UpgradeToVersion: "9.0.0",                         // to test that 8.14 is not returned
+		CurrentMajors:    1,                               // should return 8.12.2, 8.12.1, 8.12.0
+		PreviousMajors:   1,                               // should return 7.17.18
+		PreviousMinors:   2,                               // should return 8.12.2, 8.11.4
+		SnapshotBranches: []string{"8.x", "8.17", "7.17"}, // should return 8.13.0-SNAPSHOT, 8.12.2-SNAPSHOT
 	}
 
 	vf := fetcherMock{

but this fails

Expected :[]string{"8.18.0-SNAPSHOT", "8.17.1", "8.17.1-SNAPSHOT", "8.16.3", "7.17.28-SNAPSHOT"}
Actual   :[]string{"8.18.0-SNAPSHOT", "8.17.1", "8.17.1-SNAPSHOT", "8.16.3", "8.14.0-SNAPSHOT"}

could you please update the unit-test to capture the example you mention in the description @michalpristas ? 🙂

@michalpristas
Copy link
Contributor Author

michalpristas commented Jan 30, 2025

@pkoutsovasilis did you do git fetch before?
problem is that your snapshot list (list that is returned by the api based on snapshot branches) contains too many items.
try replacing with

	snapshotList = []string{
		"7.17.28-SNAPSHOT",
		"8.17.1-SNAPSHOT",
		"8.18.0-SNAPSHOT",
	}

normally we have logic in fetcher to filter branches based on req.SnapshotBranches. but here we have mock that returns snapshotList

Copy link
Contributor

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the explanation @michalpristas , LGTM

@cmacknz
Copy link
Member

cmacknz commented Feb 3, 2025

Why are we not including 9.0.0-SNAPSHOT explicitly? Seems like we should probably start testing it, we test 8.18.0-SNAPSHOT and that is always behind the HEAD of the 8.18 branch as well.

michalpristas and others added 2 commits February 5, 2025 10:29
Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
@michalpristas
Copy link
Contributor Author

9.0 or 9.1. ? did not include it as this was not the purpose of this PR

Copy link
Contributor

mergify bot commented Feb 24, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b fix-versions upstream/fix-versions
git merge upstream/main
git push upstream fix-versions

@kaanyalti
Copy link
Contributor

I pushed to resolve merge conflicts in testVersions

Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@michalpristas
Copy link
Contributor Author

now we're failing only on airgapped flakyness
cc @jlind23

@elasticmachine
Copy link
Contributor

elasticmachine commented Feb 25, 2025

💚 Build Succeeded

History

cc @michalpristas

@pkoutsovasilis pkoutsovasilis added backport-active-all Automated backport with mergify to all the active branches and removed backport-skip labels Feb 25, 2025
@pkoutsovasilis pkoutsovasilis merged commit 2614cb5 into elastic:main Feb 25, 2025
16 checks passed
mergify bot pushed a commit that referenced this pull request Feb 25, 2025
* 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)
mergify bot pushed a commit that referenced this pull request Feb 25, 2025
* 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
mergify bot pushed a commit that referenced this pull request Feb 25, 2025
* 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
mergify bot pushed a commit that referenced this pull request Feb 25, 2025
* 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
mergify bot pushed a commit that referenced this pull request Feb 25, 2025
* 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/upgradetest/versions.go
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
backport-active-all Automated backport with mergify to all the active branches bug Something isn't working skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants