-
Notifications
You must be signed in to change notification settings - Fork 32
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 test_file_checker in check_mtime case #4873
Conversation
55d4928
to
fc822cf
Compare
fc822cf
to
9a0bb45
Compare
9a0bb45
to
885904c
Compare
tests/integration/test_fim/test_files/test_file_checks/test_file_checkers.py
Show resolved
Hide resolved
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.
The regular_file_cud
function does too many things, it is practically the whole test. The best solution would be to refactor this function to be able to split the different tasks, but this would affect most of the FIM tests, and knowing that these tests will be deprecated in the future and worked on by the core team to implement them in GitHub Actions, we can accept this solution.
tests/integration/test_fim/test_files/test_file_checks/test_file_checkers.py
Show resolved
Hide resolved
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 left a comment, It would be helpful to have a comment in the code explaining why we are doing this.
885904c
to
37ed788
Compare
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!
37ed788
to
6de68b4
Compare
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
Description
This PR is to fix some false negative cases that were coming up in the
test_file_checkers
.This test configures a Wazuh directory with
check_all=no
andcheck_mtime=yes
so only thetimestamp
will be taken into account by FIM to see if there have been changes in the file. And if it coincides that the added and the modified happen in the same second (same timestamp), the modification event is not detected and that's why the test fails.To solve it I have included a sleep of one second after the creation of the file for the case of the
check_mtime
. This way we make sure that the timestamp of the event is different and we get correctly the alert.Jenkins build success:
https://ci.wazuh.info/job/Test_integration/45871/