-
Notifications
You must be signed in to change notification settings - Fork 155
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
Move FakeInput tests into their own test suite #4079
Conversation
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
This pull request does not have a backport label. Could you fix it @faec? 🙏
NOTE: |
|
Unrelated failure #4076 |
@faec do we need another round of review or should I force merge this one as the failure is unrelated to this change? |
Tests using the FakeInput and FakeShipper components need to run Agent test code in a temporary test directory. To do this, they need to modify the global flags
unversionedHome
andtopPath
. However, they can't safely restore these flags at the end of the test, because it is detected as a data race with access of these flags during the test execution (logically this is not a real race but the race detector doesn't know that).This PR resolves that by moving these tests into their own test suite, which sets the correct temporary paths at the beginning of each test instead of through a manual helper function call. This way the globals don't need to be explicitly cleaned up after the tests, and there's less risk of omitting the temporary directory setup in a test where it's needed.
The diff is less than it looks like, since (other than moving to a different file) most tests only have changes in their first couple lines.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksI have added an entry in./changelog/fragments
using the changelog toolI have added an integration test or an E2E testRelated issues