-
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
Improve the agent_files_deletion
test
#2296
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.
GJ, but some changes are required.
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
bca0a10
to
4b5d228
Compare
After @Rebits review, the first wazuh-qa/tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py Line 41 in 4b5d228
However, the other two Lastly, two lines were added at the beginning of the test to clean the old |
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.
'However, the other two sleep functions present in the code are necessary as it seems that there is no log registering the addition of information to the global.db database. This addition takes almost 50 seconds, so the time to sync is set to 60'
The addition of the agent information to global.db can be found in ossec.log with debug 2 for modulesd:
wazuh-modulesd:database[21279] wm_database.c:279 at wm_sync_agents(): DEBUG: Synchronizing agent 38990 '1-5srgA8E40i9Wj3tz-debian10'.
I suggest adding a new HostMonitor to detect this addition in the master node. Also, 50 seconds seems to be a lot of time for an already connected agent to appear in global.db.
a2871a6
to
3cdf73a
Compare
Modified the test according to the feedback and explained all the changes here. |
3cdf73a
to
d1e0a10
Compare
files_deletion
testagent_files_deletion
test
03237e5
to
8bd17a4
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.
LGTM
Hi team, some comments after my review:
|
c2eba34
9e43f99
to
1f9deb5
Compare
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
1f9deb5
to
95a2b6b
Compare
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
tests/system/test_cluster/test_agent_files_deletion/test_agent_files_deletion.py
Outdated
Show resolved
Hide resolved
These are the test results after applying the changes proposed by @juliamagan:
|
3c6e20c
to
0f14e59
Compare
response = host_manager.make_api_call(host=master_host, method='GET', token=master_token, | ||
endpoint='/agents?status=active') | ||
assert response['status'] == 200, 'Failed when trying to get the active agents' | ||
if int(response['json']['data']['total_affected_items']) == 4: |
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.
We should check that the expected agent is active, not that there are 4 total_affected_items
elif time() > timeout: | ||
print("The agent 'wazuh-agent3' is not 'Active' yet.") |
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.
We are not exiting the while, so when we can't find the wazuh-agent3
active, the test will keep printing The agent 'wazuh-agent3' is not 'Active' yet.
forever.
Added @juliamagan's changes. Tests results after modifications:
|
Description
This closes #2282. In this PR we are adding two
sleep
functions in different places in order to: