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

Fix TestRemovePath flakiness on windows #3431

Merged
merged 4 commits into from
Sep 19, 2023
Merged

Conversation

pchila
Copy link
Contributor

@pchila pchila commented Sep 18, 2023

What does this PR do?

Slightly modified the RemovePath retry loop on windows adding another iteration after deleting a blocking executable.

Why is it important?

We want to make sure that we can uninstall elastic-agent even if a binary is still executing within the directory but we want to avoid false positives

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

Author's Checklist

  • [ ]

How to test this PR locally

Just run the test on windows (multiple times would be ideal) like:

gotestsum -- -count 1000 -v -run '^TestRemovePath$' github.com/elastic/elastic-agent/internal/pkg/agent/install/

Related issues

Use cases

Screenshots

Logs

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?
  • ...

@pchila pchila added bug Something isn't working Team:Elastic-Agent Label for the Agent team Testing backport-v8.10.0 labels Sep 18, 2023
@pchila pchila requested a review from a team as a code owner September 18, 2023 12:06
@pchila pchila self-assigned this Sep 18, 2023
@elasticmachine
Copy link
Collaborator

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

@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 18, 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-09-18T16:01:59.801+0000

  • Duration: 28 min 0 sec

Test stats 🧪

Test Results
Failed 0
Passed 6301
Skipped 59
Total 6360

💚 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
Collaborator

elasticmachine commented Sep 18, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.78% (81/82) 👍
Files 66.327% (195/294) 👍
Classes 65.751% (359/546) 👍
Methods 52.76% (1128/2138) 👍
Lines 38.183% (12792/33502) 👎 -0.027
Conditionals 100.0% (0/0) 💚

Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

Looks good, but I'd add a changelog entry. If it turns out the currently released version of this code has an issue users and support will want the changelog to help know which version has the fix.

}

time.Sleep(50 * time.Millisecond)
Copy link
Member

Choose a reason for hiding this comment

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

I think it might be too much pressure on the OS. But it's a guess. However I think a counter of how many tries happened would be good.

Copy link
Member

Choose a reason for hiding this comment

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

50 milliseconds is a long time to a computer, this is an improvement over what it did before which was not sleeping.

I'd be in favour of logging how long this function took to complete so we can tell if any future flakiness is just related to marginal timing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pchila
Copy link
Contributor Author

pchila commented Sep 19, 2023

buildkite test this

@elastic-sonarqube
Copy link

@pchila pchila merged commit 995b85c into elastic:main Sep 19, 2023
25 checks passed
mergify bot pushed a commit that referenced this pull request Sep 19, 2023
Slightly modified the RemovePath retry loop on windows adding another iteration after deleting a blocking executable and introducing a small sleep between attempts.

(cherry picked from commit 995b85c)
pchila added a commit that referenced this pull request Sep 25, 2023
Slightly modified the RemovePath retry loop on windows adding another iteration after deleting a blocking executable and introducing a small sleep between attempts.

(cherry picked from commit 995b85c)

Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.10.0 bug Something isn't working Team:Elastic-Agent Label for the Agent team Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flaky Test] TestRemovePath (internal/pkg/agent/install)
5 participants