wazuh / wazuh

Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
https://wazuh.com/
Other
9.44k stars 1.49k forks source link

Recalculate agent-group hash when executing Agent-group send/recv full #23447

Closed fdalmaup closed 2 weeks ago

fdalmaup commented 2 weeks ago
Related issue
#23432

Description

Adds the global recalculate-agent-group-hashes command to recalculate the agent-groups hash both in the master and workers when the Agent-group send full is triggered.

Logs example

Description of the manual tests executed in https://github.com/wazuh/wazuh/issues/23432#issuecomment-2112919762.

Unit Tests

$ pytest framework/wazuh/core/cluster/tests/ --disable-warnings
=========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.9.19, pytest-7.3.1, pluggy-0.13.1
rootdir: /home/fdalmau/git/wazuh/framework
plugins: cov-2.12.0, aiohttp-1.0.4, trio-0.7.0, anyio-3.6.2, metadata-2.0.2, tavern-1.23.5, asyncio-0.18.1, html-2.1.1
asyncio: mode=auto
collected 303 items                                                                                                                                                                                       

framework/wazuh/core/cluster/tests/test_client.py ................                                                                                                                                  [  5%]
framework/wazuh/core/cluster/tests/test_cluster.py ...................................                                                                                                              [ 16%]
framework/wazuh/core/cluster/tests/test_common.py ......................................................................................                                                            [ 45%]
framework/wazuh/core/cluster/tests/test_control.py ......                                                                                                                                           [ 47%]
framework/wazuh/core/cluster/tests/test_local_client.py ..............                                                                                                                              [ 51%]
framework/wazuh/core/cluster/tests/test_local_server.py ........................                                                                                                                    [ 59%]
framework/wazuh/core/cluster/tests/test_master.py ...............................................                                                                                                   [ 75%]
framework/wazuh/core/cluster/tests/test_server.py .............................                                                                                                                     [ 84%]
framework/wazuh/core/cluster/tests/test_utils.py ............                                                                                                                                       [ 88%]
framework/wazuh/core/cluster/tests/test_worker.py ..................................                                                                                                                [100%]

==================================================================================== 303 passed, 24 warnings in 1.45s =====================================================================================
fdalmaup commented 2 weeks ago

The test_agent_PUT_endpoints.tavern.yaml tests were executed locally for the enhancement/23432-group-hash-recalculate branch resulting in the same failure as the one seen in the checks. Also, these were executed for Wazuh v4.7.4 which resulted in the same fail (execution here). An issue will be opened to investigate the cause.

Selutario commented 2 weeks ago

The failing framework unit test check is related to Jenkins. The same happened in v4.7.4.