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

skip downgrade test when only one snapshot version is available #3293

Conversation

AndersonQ
Copy link
Member

@AndersonQ AndersonQ commented Aug 25, 2023

Commit message:

Tile:
skip downgrade test when only one snapshot version is available (#3293)
Message:
TestStandaloneUpgradeToSpecificSnapshotBuild actually test a downgrade to a previous SNAPSHOT. This fix renames it to TestStandaloneDowngradeToPreviousSnapshotBuild. It also skips the test if there is only one SNAPSHOT available as, in that case, there is no 'previous' SNAPSHOT to downgrade to.

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

  • My code follows the style guidelines of this project
  • [ ] 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 test

How to test this PR locally

INSTANCE_PROVISIONER="multipass" \
SNAPSHOT=true \
TEST_PLATFORMS="linux/amd64" \
mage integration:single TestStandaloneUpgradeToSpecificSnapshotBuild

Related issues

  • N/A

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

It fixes TestStandaloneUpgradeToSpecificSnapshotBuild to work is there is only one snapshot build available.
@AndersonQ AndersonQ added flaky-test Unstable or unreliable test cases. skip-changelog backport-v8.9.0 Automated backport with mergify backport-v8.10.0 Automated backport with mergify labels Aug 25, 2023
@AndersonQ AndersonQ self-assigned this Aug 25, 2023
@AndersonQ AndersonQ requested a review from a team as a code owner August 25, 2023 05:39
@AndersonQ AndersonQ changed the title make teat work with only one snapshot version make TestStandaloneUpgradeToSpecificSnapshotBuild work with only one snapshot version Aug 25, 2023
@elasticmachine
Copy link
Contributor

elasticmachine commented Aug 25, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-08-25T05:59:33.512+0000

  • Duration: 32 min 59 sec

Test stats 🧪

Test Results
Failed 0
Passed 6217
Skipped 47
Total 6264

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Contributor

elasticmachine commented Aug 25, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.765% (80/81) 👍
Files 67.368% (192/285) 👍
Classes 66.105% (353/534) 👍
Methods 52.874% (1104/2088) 👍
Lines 38.615% (12610/32656) 👍 0.043
Conditionals 100.0% (0/0) 💚

@pierrehilbert pierrehilbert added the Team:Elastic-Agent Label for the Agent team label Aug 25, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@AndersonQ AndersonQ changed the title make TestStandaloneUpgradeToSpecificSnapshotBuild work with only one snapshot version skip downgrade test when only one snapshot version is available (#3293) Aug 25, 2023
@AndersonQ AndersonQ enabled auto-merge (squash) August 25, 2023 10:01
@AndersonQ AndersonQ changed the title skip downgrade test when only one snapshot version is available (#3293) skip downgrade test when only one snapshot version is available Aug 25, 2023
@pierrehilbert pierrehilbert disabled auto-merge August 25, 2023 10:16
@pierrehilbert
Copy link
Contributor

I force merge this one as it helps us to move in a direction with less tests failing.

@pierrehilbert pierrehilbert merged commit 22c276d into elastic:main Aug 25, 2023
mergify bot pushed a commit that referenced this pull request Aug 25, 2023
* 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)
Copy link
Member

@pchila pchila left a 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

Comment on lines +278 to +280
// 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.
Copy link
Member

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

Suggested change
// 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) {
Copy link
Member

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

Suggested change
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) {

mergify bot pushed a commit that referenced this pull request Aug 25, 2023
* 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)
pierrehilbert pushed a commit that referenced this pull request Aug 28, 2023
… (#3296)

* 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)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
AndersonQ added a commit that referenced this pull request Aug 30, 2023
* 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)
@AndersonQ AndersonQ deleted the fix-TestStandaloneUpgradeToSpecificSnapshotBuild branch September 13, 2023 14:49
AndersonQ added a commit to AndersonQ/elastic-agent that referenced this pull request Sep 13, 2023
…tic#3293)

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)
AndersonQ added a commit that referenced this pull request Sep 28, 2023
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)
AndersonQ added a commit that referenced this pull request Sep 29, 2023
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)
AndersonQ added a commit that referenced this pull request Oct 2, 2023
… (#3297)

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)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.9.0 Automated backport with mergify backport-v8.10.0 Automated backport with mergify flaky-test Unstable or unreliable test cases. skip-changelog Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants