Skip to content
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: WAZUH-DB - 2507: agent with state different than never_connected is added to a "group_test" group by CLI #2652

Merged

Conversation

CamiRomero
Copy link
Contributor

@CamiRomero CamiRomero commented Mar 9, 2022

Description

In this PR the test suite for agent with state different than never_connected is added to a "Y" group by CLI is added. A total of 4 new test cases covering different modes and combinations of options.

Related issues #2507 #10771

Cases:

  • Assign agent to a group test
    - The agent is active and connects with master is assigned to a group with CLI
    - The agent is disconnected and connects with master is assigned to a group with CLI
    - The agent is active and connects with worker is assigned to a group with CLI
    - The agent is disconnected and connects with worker is assigned to a group with CLI

Configuration options

In order to run the test, first the environment located in /test/system/provisioning/enrollment_cluster 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

Test Path Os/Type Execution Type Results Date By
test/system/test_cluster/test_agent_groups/test_assign_agent_to_a_group.py CentOS - Manager Local 🟢🔵🔵 09/03/2022 @CamiRomero

Required

  • Proven that tests pass when they have to pass.
  • Proven that tests fail when they have to fail.
  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py.
  • Python codebase is documented following the Google Style for Python docstrings.

@CamiRomero CamiRomero self-assigned this Mar 9, 2022
@damarisg damarisg changed the title System Test: Module (WAZUH-DB) - agent with state different than never_connected is added to a "Y" group by CLI System Test: WAZUH-DB - agent with state different than never_connected is added to a "Y" group by CLI Mar 9, 2022
@damarisg damarisg changed the title System Test: WAZUH-DB - agent with state different than never_connected is added to a "Y" group by CLI System Test: WAZUH-DB - 2507: agent with state different than never_connected is added to a "Y" group by CLI Mar 9, 2022
@damarisg damarisg changed the title System Test: WAZUH-DB - 2507: agent with state different than never_connected is added to a "Y" group by CLI System Test: WAZUH-DB - 2507 agent with state different than never_connected is added to a "Y" group by CLI Mar 9, 2022
@damarisg damarisg changed the title System Test: WAZUH-DB - 2507 agent with state different than never_connected is added to a "Y" group by CLI System Test: WAZUH-DB - 2507: agent with state different than never_connected is added to a "Y" group by CLI Mar 9, 2022
Comment on lines 27 to 35
@pytest.fixture(scope='function')
def clean_environment():

clean_cluster_logs(test_infra_agents + test_infra_managers, host_manager)

yield
# Remove the agent once the test has finished
remove_cluster_agents(test_infra_managers[0], test_infra_agents, host_manager)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was it defined here and not the same aggregate method used in conftes.py?

@damarisg damarisg changed the title System Test: WAZUH-DB - 2507: agent with state different than never_connected is added to a "Y" group by CLI System Test: WAZUH-DB - 2507: agent with state different than never_connected is added to a "group_test" group by CLI Mar 14, 2022
@Deblintrake09
Copy link
Contributor

Deblintrake09 commented Mar 15, 2022

Tests Results

Test Path Os/Type Execution Type Results Date By
test/system/test_cluster/test_agent_groups/test_assign_agent_to_a_group.py CentOS - Manager Local 🟢🟢🟢 15/03/2022 @Deblintrake09

Comment on lines 16 to 17
WAZUH_SERVICES_STOPPED = 'stopped'
WAZUH_SERVICE_PREFIX = 'wazuh'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should define in the deps/wazuh_testing/wazuh_testing/modules/__init__.py.
Remember that this file deps/wazuh_testing/wazuh_testing/wazuh_variables.py will remove in the future.

from system import (AGENT_NO_GROUPS, AGENT_STATUS_ACTIVE, AGENT_STATUS_DISCONNECTED, check_agent_groups,
check_agent_status, restart_cluster, check_keys_file, assign_agent_to_new_group,
delete_group_of_agents, ERR_MSG_CLIENT_KEYS_IN_MASTER_NOT_FOUND)
from wazuh_testing.wazuh_variables import WAZUH_SERVICES_STOPPED, WAZUH_SERVICE_PREFIX
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from wazuh_testing.wazuh_variables import WAZUH_SERVICES_STOPPED, WAZUH_SERVICE_PREFIX
from wazuh_testing.modules import WAZUH_SERVICES_STOPPED, WAZUH_SERVICE_PREFIX

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAZUH_SERVICE_PREFIX should define in the deps/wazuh_testing/wazuh_testing/modules/__init__.py. Remember that this file deps/wazuh_testing/wazuh_testing/wazuh_variables.py will remove in the future.

@Deblintrake09
Copy link
Contributor

Tests Results

Test Path Os/Type Execution Type Results Date By
test/system/test_cluster/test_agent_groups/test_assign_agent_to_a_group.py CentOS - Manager Local 🟢🟢🟢 16/03/2022 @Deblintrake09

@damarisg damarisg merged commit f6f0956 into system_test_wazuh_db Mar 16, 2022
@damarisg damarisg deleted the 2507_system_test_assign_agent_to_a_group branch March 16, 2022 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants