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

runtime and agent test improvements #2014

Merged
merged 4 commits into from
Dec 23, 2024
Merged

runtime and agent test improvements #2014

merged 4 commits into from
Dec 23, 2024

Conversation

zackattack01
Copy link
Contributor

runtime

  • renames testOsqueryBinaryDirectory to testOsqueryBinary for clarity. this was being used as a full path, and our download helpers alter this path to add .exe but our global variable was not getting the same update, causing some confusing error messages. e.g. no binary at C:\Users\zack-\AppData\Local\Temp\3167415370\osqueryd when one does exist at C:\Users\zack-\AppData\Local\Temp\3167415370\osqueryd.exe
  • adds the .exe extension to the variable for windows so those error messages stop
  • the osqueryd.exe, and the parent temp dir was also never being cleaned up due to use of defer before os.Exit. this updates to use explicit removal calls for all error cases and before exiting
  • i do not expect this to fix test flakiness (I think we have various bits of logic that know to add the exe when required). hope is that these will be less confusing to debug and will stop leaking old test artifacts

agent

  • noticed while looking into this that there were also several osquery-runsimple directories left behind- looking at the agent reset_test.go we have the same defer vs os.Exit problem. this one does seem to add the .exe correctly so nothing needed there

@zackattack01 zackattack01 marked this pull request as ready for review December 23, 2024 17:44
@zackattack01 zackattack01 added this pull request to the merge queue Dec 23, 2024
Merged via the queue into main with commit a5c83f1 Dec 23, 2024
32 checks passed
@zackattack01 zackattack01 deleted the zack/runtime_tests branch December 23, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants