-
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
System Tests: FIM - Synchronization process #2443
System Tests: FIM - Synchronization process #2443
Conversation
|
||
|
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.
Add 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.
Also, Add the changelog.md
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.
def create_folder(folder_path): | ||
# Create folder | ||
host_manager.run_command('wazuh-agent1', f'mkdir {folder_path}') | ||
|
||
# Create file | ||
host_manager.run_command('wazuh-agent1', f'touch {folder_path}/{folder_path}.txt') | ||
|
||
|
||
def clean_logs(): | ||
host_manager.clear_file(host='wazuh-manager', file_path=os.path.join(WAZUH_LOGS_PATH, 'ossec.log')) | ||
host_manager.clear_file(host='wazuh-agent1', file_path=os.path.join(WAZUH_LOGS_PATH, 'ossec.log')) | ||
|
||
|
||
def wait_for_fim_scan_end(folder_path): | ||
try: | ||
HostMonitor(inventory_path=inventory_path, | ||
messages_path=messages_path[2], | ||
tmp_path=tmp_path).run() | ||
finally: | ||
host_manager.run_command('wazuh-agent1', f'rm -rf {folder_path}') | ||
|
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.
Could these methods be parameterized and added outside of the test to be used by other tests in the future or would it cause problems?
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.
Done in commit 5972a
host_manager.run_command('wazuh-agent1', f'rm -rf {folder_path}') | ||
|
||
try: | ||
# Run the callback checks for the ossec.log | ||
HostMonitor(inventory_path=inventory_path, | ||
messages_path=messages_path[0], | ||
tmp_path=tmp_path).run() | ||
finally: | ||
host_manager.run_command('wazuh-agent1', f'rm -rf {folder_path}') |
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.
Is it could be a problem? Why you remove 2 times the same file?
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.
Done in commit 79d05
|
||
|
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.
Also, Add the changelog.md
|
|
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.
Approved
Tests
Run | Results | Date | By | Notes |
---|---|---|---|---|
R1 | 🟢 | 26/01/2021 | @Deblintrake09 | |
R2 | 🟢 | 26/01/2021 | @Deblintrake09 | |
R3 | 🟢 | 26/01/2021 | @Deblintrake09 |
tests/system/test_fim/__init__.py
Outdated
def clean_logs(host_manager): | ||
host_manager.clear_file(host='wazuh-manager', file_path=os.path.join(WAZUH_LOGS_PATH, 'ossec.log')) | ||
host_manager.clear_file(host='wazuh-agent1', file_path=os.path.join(WAZUH_LOGS_PATH, 'ossec.log')) |
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.
Could you use clean_environment
method, please?
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.
Done in commit 91ef4
"""Clears a series of files on target hosts managed by a host manager | ||
Args: | ||
host_manager (object): a host manager object with not None inventory_path | ||
target_files (dict): a dictionary of tuples, each with the host and the path of the file to clear. |
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.
target_files (dict): a dictionary of tuples, each with the host and the path of the file to clear. | |
target_files (dict): a list of tuples, each with the host and the path of the file to clear. |
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.
Done in commit 0f4c9
Tests
|
|
||
docker_network: "cluster_net" | ||
|
||
image: "dontpanicat/debian:buster" |
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.
Do not use third party docker images
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.
When we applied the suggested changes, we note that there is a conflict with access to the remote host via ssh. We will open an Issue to work on that.
def test_file_cud(folder_path, case): | ||
''' | ||
The test will monitor a directory. | ||
Finally, it will verify that the FIM event is generated | ||
in agent and manager side. | ||
''' | ||
messages = messages_path[0] |
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 test_
documentation does not apply to Schema 2.0.
Let's document the test as we did with other integration tests, or same you did with the module doc.
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.
Done in commit 2622c
…thub.com:wazuh/wazuh-qa into 2389-System-test-for-fim-synchronization-process
Description
The test check that FIM currently work when we have a folder monitored and we performed some action like create the file, modify or delete files, the manager receives the changes
Configuration options
In order to run the test, first the environment located in /test/system/provisioning/one_manager_agent must be enabled with:
sudo ansible-playbook -i inventory.yml playbook.yml --extra-vars='{"wazuh_branch": "4.2"}'
Logs example
Tests
Tests
pycodestyle --max-line-length=120 --show-source --show-pep8 file.py
.