Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Review agent's upgrade tests and change used versions if necessary #4320

Closed
rdner opened this issue Feb 22, 2024 · 3 comments
Closed

Review agent's upgrade tests and change used versions if necessary #4320

rdner opened this issue Feb 22, 2024 · 3 comments
Assignees
Labels
Team:Elastic-Agent Label for the Agent team

Comments

@rdner
Copy link
Member

rdner commented Feb 22, 2024

All the preliminary research was done here #4296 (comment)

We should review all our current upgrade tests and decide whether using the versions they use actually makes sense.

The goal is to minimize the amount of different versions used for testing, we currently have:

  • define.Version() => define.Version()
  • define.Version() => define.Version()-SNAPSHOT
  • define.Version() => PreviousMinor
  • PreviousMinor => define.Version()
  • define.Version() => define.Version()-SNAPSHOT+<lastBuildID>
  • define.Version() => define.Version()-SNAPSHOT+<lastBuildID~1>
  • GetUpgradableVersions(ctx, define.Version(), 2, 1) => define.Version()

FYI: versions returned from GetUpgradableVersions() and PreviousMinor() are stable/deterministic and configured by a file.

@rdner rdner added the Team:Elastic-Agent Label for the Agent team label Feb 22, 2024
@rdner
Copy link
Member Author

rdner commented Mar 20, 2024

I noticed that the following test cases request a build version:

TestStandaloneUpgradeRetryDownload

// Upgrade to an older snapshot build of same version but with a different commit hash
aac := tools.NewArtifactAPIClient(tools.WithLogFunc(t.Logf))
buildInfo, err := aac.FindBuild(ctx, startVersion.VersionWithPrerelease(), startVersionInfo.Binary.Commit, 0)

TestStandaloneUpgradeUninstallKillWatcher

// Start on a snapshot build, we want this test to upgrade to our
// build to ensure that the uninstall will kill the watcher.
// We need a snapshot with a non-matching commit hash to perform the upgrade
aac := tools.NewArtifactAPIClient(tools.WithLogFunc(t.Logf))
buildInfo, err := aac.FindBuild(ctx, endVersion.VersionWithPrerelease(), endVersionInfo.Binary.Commit, 0)

From the name of the tests I don't think they should use build versions, what do you think
@pchila ?

We're trying to minimize the use of the artifact API due to #4268 so I'd just use the current snapshot and skip the test when commit hashes match.

@rdner rdner self-assigned this Mar 20, 2024
@pchila
Copy link
Member

pchila commented Mar 20, 2024

I noticed that the following test cases request a build version:

TestStandaloneUpgradeRetryDownload

// Upgrade to an older snapshot build of same version but with a different commit hash
aac := tools.NewArtifactAPIClient(tools.WithLogFunc(t.Logf))
buildInfo, err := aac.FindBuild(ctx, startVersion.VersionWithPrerelease(), startVersionInfo.Binary.Commit, 0)

TestStandaloneUpgradeUninstallKillWatcher

// Start on a snapshot build, we want this test to upgrade to our
// build to ensure that the uninstall will kill the watcher.
// We need a snapshot with a non-matching commit hash to perform the upgrade
aac := tools.NewArtifactAPIClient(tools.WithLogFunc(t.Logf))
buildInfo, err := aac.FindBuild(ctx, endVersion.VersionWithPrerelease(), endVersionInfo.Binary.Commit, 0)

From the name of the tests I don't think they should use build versions, what do you think @pchila ?

We're trying to minimize the use of the artifact API due to #4268 so I'd just use the current snapshot and skip the test when commit hashes match.

I think those test can be changed to use regular snapshots/released versions without any loss of functionality. If the build lookup is just to avoid hash collision we can change them after implementing #4380 and have those tests try to upgrade to latest snapshot for the given version

@rdner
Copy link
Member Author

rdner commented Sep 10, 2024

I think further adjustments are no longer necessary. Closing now.

@rdner rdner closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

No branches or pull requests

2 participants