Closed mauromalara closed 1 year ago
Seems to be related with: https://github.com/wazuh/wazuh/issues/16080
The issue is not reproducible in our environments, please help @GabrielEValenzuela to reproduce them.
Hi @mauromalara !
Could you send me the steps that you used to reproduce this issue ?
I was writing this report about this.
During the testing phase of version 4.6.0.alpha1
, it has been observed that a subset of test cases is failing affecting the syscollector modules. In total, 5 out of 26 test cases have failed during this phase.
The following table provides a summary of the test cases that have failed along with the specific configuration values that trigger these failures:
Test case | Configuration provided that make the test fail |
---|---|
empty_value_ports | <ports all="no" /> |
empty_value_all_ports | <ports all="">yes</ports> |
empty_value_processes | <processes /> |
invalid_value_disabled | <disabled>invalid</disabled> |
check_syscollector_scan | N/A |
Using a manager version 4.x
and the Windows agent downloaded from the packages-dev repository, we installed agent version 4.6.0
on a Windows 10 Pro build 19045 VM with the following configuration common to all manual test cases.
For each test, we provide the extract of the ossec.conf
and ossec.log
highlighting the differences between the expected and obtained results.
The issue is not reproducible in our environments.
pytests
locally and debug the code in order to find where the error/defect isIt's a race condition produced by the tests. 🔴
4.6.0
4.6.0
4.5.2
: https://github.com/wazuh/wazuh/issues/18622After running manual tests, the error cannot be reproduced, either by me or the developer.
I executed the tests and now the error appears.
So, we can conclude that the error appears only when automatic tests are executed.
This is the fix proposed for the test:
# tests/integration/test_syscollector/test_syscollector_configuration.py
.
.
.
import os
import sys
import time
.
.
.
def test_syscollector_invalid_configurations(...):
.
.
.
# Wait 100 ms to avoid race condition
time.sleep(0.1)
After executing the tests with said fix they've passed successfully:
$ python -m pytest -vvv -x tests/integration/test_syscollector/ --html="report-1.html" --pdb -k "not test_syscollector_scanning"
============================= test session starts =============================
platform win32 -- Python 3.8.0, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.8.0', 'Platform': 'Windows-10-10.0.20348-SP0', 'Packages': {'pytest': '6.2.2', 'pluggy': '0.13.1'}, 'Plugins': {'html': '3.1.1', 'metadata': '2.0.4', 'testinfra': '5.0.0'}}
rootdir: C:\Users\Administrator\wazuh-qa\tests\integration, configfile: pytest.ini
plugins: html-3.1.1, metadata-2.0.4, testinfra-5.0.0
collecting ... collected 27 items / 1 deselected / 26 selected
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_deactivation[check_syscollector_deactivation] PASSED [ 3%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_all_scans_disabled[all_scans_disabled] PASSED [ 7%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_disabled] PASSED [ 11%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_interval] PASSED [ 15%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_scan_on_start] PASSED [ 19%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_hardware] PASSED [ 23%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_os] PASSED [ 26%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_network] PASSED [ 30%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_packages] PASSED [ 34%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_ports] PASSED [ 38%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_all_ports] PASSED [ 42%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_processes] PASSED [ 46%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_disabled] PASSED [ 50%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_interval] PASSED [ 53%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_scan_on_start] PASSED [ 57%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_hardware] PASSED [ 61%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_os] PASSED [ 65%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_network] PASSED [ 69%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_packages] PASSED [ 73%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_ports] PASSED [ 76%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_all_ports] PASSED [ 80%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_processes] PASSED [ 84%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_max_eps] PASSED [ 88%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[empty_value_hotfixes] PASSED [ 92%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_invalid_configurations[invalid_value_hotfixes] PASSED [ 96%]
tests\integration\test_syscollector\test_syscollector_configuration.py::test_syscollector_default_values[check_default_values] XFAIL [100%]
-- generated html file: file://C:\Users\Administrator\wazuh-qa\report-1.html --
=========== 25 passed, 1 deselected, 1 xfailed in 232.47s (0:03:52) ===========
More rounds are being executed to validate the change.
Update
After 3 executions it seems that the fix is not stable. The issue will be marked as qa_known
.
It is not a product issue according to the creator of the issue.
This type of failure is because the database file is taken by another process. If you notice this problem under unwanted behavior, please reopen it.
We found a possible relation with a previous issue that shows the same behavior in the FIM database. Issue #4692 and its corresponding pull request #4708 introduce a mechanism to retry the deletion of the database file due to a failure with the host operating system, which does not release the owner of the file immediately and causes the error of the std::remove
function. We tested this behavior in our environment and we're working in a fix.
While running the integration tests for
4.6.0-alpha1
we found that when using an invalid Syscollector configuration Wazuh does not start correctly. So, the tests fail because they expect some logs to appear, but they never do.Evidence: syscollector-agent-windows.zip
Note: The
test_syscollector_scanning
test fails because of a known issue: https://github.com/wazuh/wazuh-qa/issues/4230Error preview: