-
Notifications
You must be signed in to change notification settings - Fork 146
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
skip downgrade test when only one snapshot version is available #3293
skip downgrade test when only one snapshot version is available #3293
Conversation
It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work is there is only one snapshot build available.
🌐 Coverage report
|
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
I force merge this one as it helps us to move in a direction with less tests failing. |
* make teat work with only one snapshot version It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work is there is only one snapshot build available. * . * . (cherry picked from commit 22c276d)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggestion but overall it looks good
// normally the output of the versions returned by artifact API is already | ||
// sorted in ascending order.If we want to sort in descending order we need | ||
// to pass a sort.Reverse to sort.Sort. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing the meaning of this comment maybe we can clarify the wording a bit like
// normally the output of the versions returned by artifact API is already | |
// sorted in ascending order.If we want to sort in descending order we need | |
// to pass a sort.Reverse to sort.Sort. | |
// normally the output of the versions returned by artifact API is already | |
// sorted in ascending order. Since we want to extract the most recent version, | |
// we sort in descending order by passing a sort.Reverse operator to sort.Sort. |
@@ -261,7 +261,7 @@ func TestStandaloneUpgradeWithGPGFallback(t *testing.T) { | |||
testStandaloneUpgrade(ctx, t, agentFixture, parsedVersion, toVersion, "", false, false, true, customPGP) | |||
} | |||
|
|||
func TestStandaloneUpgradeToSpecificSnapshotBuild(t *testing.T) { | |||
func TestStandaloneDowngradeToPreviousSnapshotBuild(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the previous test name as it's the feature name. we may add a comment for clarity
func TestStandaloneDowngradeToPreviousSnapshotBuild(t *testing.T) { | |
// Here we test the ability of elastic agent to upgrade to a given snapshot build (not necessarily the latest) | |
// by passing a version `x.y.z-SNAPSHOT+<buildid>`. In order to test this, we look for a build for the current | |
// snapshot version other than the latest, downgrade to such version and verify that we get the correct | |
// git commit hash for the specified build (to detect that we didn't install the latest snapshot build by mistake) | |
func TestStandaloneDowngradeToSpecificSnapshotBuild(t *testing.T) { |
* make teat work with only one snapshot version It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work is there is only one snapshot build available. * . * . (cherry picked from commit 22c276d)
* make teat work with only one snapshot version It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work is there is only one snapshot build available. * . * . (cherry picked from commit 22c276d)
It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work when there is only one snapshot build available by skipping the test if there aren't enough versions available. (cherry picked from commit 22c276d)
It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work when there is only one snapshot build available by skipping the test if there aren't enough versions available. (cherry picked from commit 22c276d)
Commit message:
What does this PR do?
It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work is there is only one snapshot build available.
Why is it important?
When there is only one snapshot version for the current version the test fails.
Checklist
[ ] I have commented my code, particularly in hard-to-understand areas[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added tests that prove my fix is effective or that my feature works[ ] I have added an entry in./changelog/fragments
using the changelog tool[ ] I have added an integration test or an E2E testHow to test this PR locally
Related issues
Questions to ask yourself