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

Fix test_file_checker in check_mtime case #4873

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

jotacarma90
Copy link
Member

@jotacarma90 jotacarma90 commented Jan 18, 2024

Related issue
#4839

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 and check_mtime=yes so only the timestamp 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/

@jotacarma90 jotacarma90 linked an issue Jan 18, 2024 that may be closed by this pull request
@jotacarma90 jotacarma90 force-pushed the 4839-check-mtime-false-negative branch from 55d4928 to fc822cf Compare January 18, 2024 15:49
@jotacarma90 jotacarma90 changed the base branch from master to 4.8.0 January 19, 2024 09:53
@jotacarma90 jotacarma90 force-pushed the 4839-check-mtime-false-negative branch from fc822cf to 9a0bb45 Compare January 19, 2024 09:58
@jotacarma90 jotacarma90 force-pushed the 4839-check-mtime-false-negative branch from 9a0bb45 to 885904c Compare January 19, 2024 10:04
juliamagan
juliamagan previously approved these changes Jan 19, 2024
Copy link
Member

@juliamagan juliamagan left a 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.

Copy link
Member

@lchico lchico left a 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.

lchico
lchico previously approved these changes Jan 22, 2024
Copy link
Member

@lchico lchico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@lchico lchico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MarcelKemp MarcelKemp merged commit 16d485f into 4.8.0 Jan 24, 2024
4 checks passed
@MarcelKemp MarcelKemp deleted the 4839-check-mtime-false-negative branch January 24, 2024 15:53
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.

FIM Test Fails for Windows Agents
4 participants