-
Notifications
You must be signed in to change notification settings - Fork 148
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 being flagged as a possible virus #3411
Fix TestRemovePath being flagged as a possible virus #3411
Conversation
This pull request does not have a backport label. Could you fix it @cmacknz? 🙏
NOTE: |
🌐 Coverage report
|
2c8009e
to
c9afc2d
Compare
/test |
Taking out of draft, got one successful run. Will run the tests a few times before merging to confirm. I expect test may still be flaky for other reasons, I just want to eliminate the virus scanning false positive with these changes. |
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
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.
LGTM.
c9afc2d
to
0b42ffc
Compare
err = RemovePath(dir) | ||
require.NoError(t, err) |
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.
Shouldn't these lines still be there? Isn't RemovePath
the function being tested?
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.
Yes they should whoops
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 did this far too quickly the first time, thanks for catching this.
Ugh |
Merging, let's see if this problem comes back after some more test runs on other branches and adjust from there. |
* Do not generate and compile blocking exe automatically. * Copy the test binary to a tmp subdir so the test actually works. * Stop exec-ing from Temp. (cherry picked from commit 72ce0fe)
* Do not generate and compile blocking exe automatically. * Copy the test binary to a tmp subdir so the test actually works. * Stop exec-ing from Temp. (cherry picked from commit 72ce0fe) Co-authored-by: Craig MacKenzie <[email protected]>
My suspicion is this test gets flagged as malware because it writes code to disk and then compiles it by executing
go build
itself. This does seem like something malware could do, so I changed this to use the same build strategy the fake component uses. Themage build:testBinary
target must be used to build the binaries before the test can run, which is a dependency ofmage unitTest
.