-
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 Test: Module (WAZUH-DB) - Sync of agents registered on nodes after seconds #2761
System Test: Module (WAZUH-DB) - Sync of agents registered on nodes after seconds #2761
Conversation
brief: This tests check that when a cluster has a series of agents registered and connecting one after the other, | ||
and it is unable to do a Sync, that after a expected time, a Sync is forced and the DB is Synched. |
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.
brief: This tests check that when a cluster has a series of agents registered and connecting one after the other, | |
and it is unable to do a Sync, that after a expected time, a Sync is forced and the DB is Synched. | |
brief: These tests check that when a cluster has a series of agents registered and connecting one after the other, | |
and it is unable to do a Sync, that after an expected time, a Sync is forced and the DB is Synched. |
parameters: | ||
- agent_host: | ||
type: List | ||
brief: name of the host where the agent will register en each case |
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.
brief: name of the host where the agent will register en each case | |
brief: name of the host where the agent will register in each case |
@pytest.mark.parametrize("test_infra_managers",[test_infra_managers]) | ||
@pytest.mark.parametrize("test_infra_agents",[test_infra_agents]) | ||
@pytest.mark.parametrize("host_manager",[host_manager]) |
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 space after comma in order to follow pycodestyle
@pytest.mark.parametrize("test_infra_managers",[test_infra_managers]) | |
@pytest.mark.parametrize("test_infra_agents",[test_infra_agents]) | |
@pytest.mark.parametrize("host_manager",[host_manager]) | |
@pytest.mark.parametrize("test_infra_managers", [test_infra_managers]) | |
@pytest.mark.parametrize("test_infra_agents", [test_infra_agents]) | |
@pytest.mark.parametrize("host_manager", [host_manager]) |
test_infra_managers = ["wazuh-master", "wazuh-worker1", "wazuh-worker2"] | ||
agents_in_cluster = 40 | ||
test_infra_agents=[] | ||
for x in range(agents_in_cluster): |
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.
Remove space at the end of the line in order to follow pycodestyle
for x in range(agents_in_cluster): | |
for x in range(agents_in_cluster): |
# Hosts | ||
test_infra_managers = ["wazuh-master", "wazuh-worker1", "wazuh-worker2"] | ||
agents_in_cluster = 40 | ||
test_infra_agents=[] |
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 space before and after equal symbol in order to follow pycodestyle
test_infra_agents=[] | |
test_infra_agents = [] |
''' | ||
description: Check that after a long time when the manager has been unable to synchronize de databases, because | ||
new agents are being continually added, database synchronization is forced and the expected information is in | ||
all nodes after the expected sync time. For this, an agent is restarted and connects to the agent every roughly 10 |
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.
Remove space at the end of line in order to follow pycodestyle
all nodes after the expected sync time. For this, an agent is restarted and connects to the agent every roughly 10 | |
all nodes after the expected sync time. For this, an agent is restarted and connects to the agent every roughly 10 |
''' | ||
|
||
# Register agents in manager | ||
agent_data=[] |
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 space before and after equal symbol in order to follow pycodestyle
agent_data=[] | |
agent_data = [] |
while time.time() < end_time: | ||
if active_agent < agents_in_cluster: | ||
host_manager.run_command(test_infra_agents[active_agent], f'{WAZUH_PATH}/bin/wazuh-control start') | ||
active_agent = active_agent +1 |
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.
missing whitespace around the operator
active_agent = active_agent +1 | |
active_agent = active_agent + 1 |
Tests Results
|
In this PR the test suite for
test_groups_sync_default.py
is added. A total of 2 new test cases cover that when having a cluster, and a series of agents is registered over time, the group data is synchronized as expected.Cases:
- Forty agents are registered to
master
and they have the default group assigned in thecluster
Configuration options
In order to run the test, first the environment located in
/test/system/provisioning/big_cluster_40_agents
must be enabled with:sudo ansible-playbook -i inventory.yml playbook.yml --extra-vars='{"wazuh_branch": "dev-10771-agent-groups-files-to-wazuh-db"}'
Local Internal Options: No Local Internal Options used
Tests Results
pycodestyle --max-line-length=120 --show-source --show-pep8 file.py
.