-
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
FIM IT: add fim sync overlap testing #3380
FIM IT: add fim sync overlap testing #3380
Conversation
@pytest.fixture(scope='function') | ||
def create_files_in_folder(files_number): | ||
"""Create files in monitored folder and files""" | ||
|
||
for file in range(0, files_number): | ||
create_file(REGULAR, MONITORED_DIR_1, f"test_file_{time.time()}_{file}") | ||
|
||
yield | ||
|
||
delete_path_recursively(MONITORED_DIR_1) | ||
|
||
|
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.
- In tools/file.py file we store different methods related to files. Why don't you add it there?
- Why don't you add the arguments in the documentation?
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.
It is not added there because this is a fixture, and needs to be located in the conftest file.
@pytest.fixture(scope='session') | ||
def configure_local_internal_options_fim(): | ||
"""Fixture to configure the local internal options file.""" | ||
|
||
# Backup the old local internal options | ||
backup_local_internal_options = get_wazuh_local_internal_options() | ||
|
||
# Set the new local internal options configuration | ||
set_wazuh_local_internal_options(create_local_internal_options(FIM_DEFAULT_LOCAL_INTERNAL_OPTIONS)) | ||
|
||
yield | ||
|
||
# Backup the old local internal options cofiguration | ||
set_wazuh_local_internal_options(backup_local_internal_options) |
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.
Why do you add it there? In the integration/conftest.py
file are these methods.
I read the description
, but could you clarify your decision applied here? I do not see sense.
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.
This is not the same as the one in integration/conftest.py
, which needs the get_local_internal_options
fixture to be present in the test module, and that uses the get_configuration
fixture.
@pytest.fixture(scope="function") | ||
def restart_syscheck_function(): | ||
""" | ||
Restart syscheckd daemon. | ||
""" | ||
control_service("stop", daemon="wazuh-syscheckd") | ||
truncate_file(LOG_FILE_PATH) | ||
control_service("start", daemon="wazuh-syscheckd") |
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.
Why do you add it there? In the integration/conftest.py
file has defined it.
When you create a new method, you should make sure it doesn't exist elsewhere so as not to duplicate code.
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.
This version This has been added here, following the structure applied to the VDT test suite refactor. Having a specific function that restarts only syscheck allows for tests to be a bit cleaner by not needing to pass the daemon to stop as a parameter.
tests/integration/test_fim/test_synchronization/data/test_cases/cases_sync_overlap.yaml
Show resolved
Hide resolved
tests/integration/test_fim/test_synchronization/data/test_cases/cases_sync_overlap.yaml
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 suggested some cases, but I didn't see them added. Was it for any reason?
Cases:
- I don't put response_timeout and max_interval, and I have synchronization enabled.
- I don't put response_timeout, and I have synchronization enabled.
- I don't put max_interval, and I have synchronization enabled.
- I put response_timeout and max_interval, the interval is greater than max_interval , and I have synchronization enabled.
- the synchronization is done before the max_interval and interval is reached.
Update 2022/10/21
|
tests/integration/test_fim/test_synchronization/test_sync_overlap.py
Outdated
Show resolved
Hide resolved
tests/integration/test_fim/test_synchronization/test_sync_overlap.py
Outdated
Show resolved
Hide resolved
tests/integration/test_fim/test_synchronization/test_sync_overlap.py
Outdated
Show resolved
Hide resolved
tests/integration/test_fim/test_synchronization/test_sync_overlap.py
Outdated
Show resolved
Hide resolved
tests/integration/test_fim/test_synchronization/test_sync_time.py
Outdated
Show resolved
Hide resolved
tests/integration/test_fim/test_synchronization/test_sync_overlap.py
Outdated
Show resolved
Hide resolved
Update 2022/11/22
Update 2022/11/23
|
Description
This PR aims to add new tests related to the behavior of the
response_timeout
synchronization option. When a new sync is fired after the sync interval has elapsed, ifresponse_timeout
time has not elapsed since the last sync message, the sync interval value will be doubled. After a successful synchronization, when a new sync is fired, the interval value will be reset to the configured value.Added
Testing performed
The test test_max_eps.py module has erratic behavior and sometimes fails. It was fixed on Issue #3036, that was merged into the target branch, so it has not been fixed here again.