-
Notifications
You must be signed in to change notification settings - Fork 30
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_sync_agent_groups_get
and add function to calculate hash
#3895
Conversation
f4e3999
to
f362438
Compare
f362438
to
cf6d5ad
Compare
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 have run the test for the 4.4
branch and the 4.4
fixed version (PR package) and in both cases the following test has failed:
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test get_global_hash in true] FAILED [ 54%]
assert str(response) == output, "Did not get expected response: {output}, recieved: {response}"
E AssertionError: Did not get expected response: {output}, recieved: {response}
E assert "[{'data': [{...cad2cb0bfd'}]" == "[{'data': [{...2505a946d7'}]"
E - [{'data': [{'id': 1, 'groups': ['Test_group1']}, {'id': 2, 'groups': ['Test_group2']}], 'hash': '0ce72e59092cdb4856971082827aeb2505a946d7'}]
E ? ^^^^^^^ ------ --- ---------------
E + [{'data': [{'id': 1, 'groups': ['Test_group1']}, {'id': 2, 'groups': ['Test_group2']}], 'hash': '49087946dd7a587ae30ae89cbc8084cad2cb0bfd'}]
E ? ^ + +++++++++++++++++++++++++++++
test_wazuh_db/test_sync_agent_groups_get.py:136: AssertionError
============================================================= short test summary info =============================================================
FAILED test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test get_global_hash in true]
========================================================== 1 failed, 21 passed in 46.43s ==========================================================
Please @QU3B1M check it.
@jmv74211 Its weird, I executed the tests on Jenkins (here) and it work as expected, maybe you took the package from the manual issue that was outdated (just now I updated it) please, try again with this |
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.
After testing with the new package, the tests have passed successfully
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test sync_status with response] PASSED [ 4%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test sync_status without response] PASSED [ 9%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'all' condition when agent groups are in 'sync_req'] PASSED [ 13%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'all' condition when agent groups are in 'synced'] PASSED [ 18%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'sync_status' condition when one agent groups are in 'synced'] PASSED [ 22%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'all' condition when one agent groups are in 'synced'] PASSED [ 27%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test with and invalid filter in condition] PASSED [ 31%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test without condition] PASSED [ 36%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test set_synced in True] PASSED [ 40%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test set_synced with invalid value - false] PASSED [ 45%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test set_synced with invalid value - String] PASSED [ 50%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test get_global_hash in true] PASSED [ 54%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test get_global_hash in false] PASSED [ 59%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test get_global_hash with invalid value] PASSED [ 63%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'agent_registration_delta' in 0 and sync_status] PASSED [ 68%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'agent_registration_delta' in 0 and all condition] PASSED [ 72%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'agent_registration_delta' with delta in 10000 and sync_status] PASSED [ 77%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test 'agent_registration_delta' with delta in 10000 and all] PASSED [ 81%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test last_id - by default] PASSED [ 86%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test last_id - obtain from second group] PASSED [ 90%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test last_id - with not exist id] PASSED [ 95%]
test_wazuh_db/test_sync_agent_groups_get.py::test_sync_agent_groups[/home/vagrant/wazuh-qa/tests/integration/test: Test last_id - with negative value] PASSED [100%]
=============================================================================================== 22 passed in 48.36s ===============================================================================================
Description
A fix on the calculation of the global groups hash made
test_sync_agent_groups_get
fail, with this modification now wazuh excludes the groups of theagent 000
from the calculation of theglobal_hash
. It was found that our test uses an hardcoded hash that was wrongly calculated (using the agent 000 group to make the hash).A function to calculate the correct hash was added in the
wazuh_db
moduleUpdated
tests/integration/test_wazuh_db/test_sync_agent_groups_get.py
deps/wazuh_testing/wazuh_testing/wazuh_db.py
Testing performed
integration/test_wazuh_db/
cf6d5ad