Fix TestRemovePath being flagged as a possible virus#3411
Fix TestRemovePath being flagged as a possible virus#3411cmacknz merged 3 commits intoelastic:mainfrom
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) |
c9afc2d to
0b42ffc
Compare
| err = RemovePath(dir) | ||
| require.NoError(t, err) |
There was a problem hiding this comment.
Shouldn't these lines still be there? Isn't RemovePath the function being tested?
There was a problem hiding this comment.
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 <craig.mackenzie@elastic.co>


My suspicion is this test gets flagged as malware because it writes code to disk and then compiles it by executing
go builditself. This does seem like something malware could do, so I changed this to use the same build strategy the fake component uses. Themage build:testBinarytarget must be used to build the binaries before the test can run, which is a dependency ofmage unitTest.