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: Module (WAZUH-DB) - Agent registered with group "group_test" (agent_authd - disconnected) #2654

Merged

Conversation

CamiRomero
Copy link
Contributor

@CamiRomero CamiRomero commented Mar 9, 2022

In this PR the test suite for Agent registered with group Y (agent_authd - disconnected) is added. A total of 2 new test cases covering different modes and combinations of options.

Related issues #2508 #10771

Cases:

  • Agent registered with group Y (agent_authd - disconnected):
    - The agent is never_connected and registers with group to the master node using agent-auth
    - The agent is never_connected and registers with group to the worker node using agent-auth

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.

Copy link
Contributor

@Deblintrake09 Deblintrake09 left a comment

Choose a reason for hiding this comment

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

GJ Cami

@Deblintrake09
Copy link
Contributor

Deblintrake09 commented Mar 11, 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 🟢🟢🟢 10/03/2022 @Deblintrake09

Comment on lines 98 to 117
try:
# Create group with agent_groups
host_manager.run_command(test_infra_managers[0], f"/var/ossec/bin/agent_groups -q -a -g {id_group}")

# Register agent with agent-auth
agent_ip, agent_id, agent_name, manager_ip = register_agent(test_infra_agents[0], agent_target,
host_manager, id_group)

# Check that agent status is never_connected in cluster
check_agent_status(agent_id, agent_name, agent_ip, 'never_connected', host_manager, test_infra_managers)

# Check that agent has group set to group_test on Managers
check_agent_groups(agent_id, id_group, test_infra_managers, host_manager)

# Check that agent has client key file
assert check_keys_file(test_infra_agents[0], host_manager)

finally:
# Delete group of agent
delete_group_of_agents('wazuh-master', id_group, 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.

I saw the case defined to create in this issue, but you don't wait the X(10) seconds like was defined. Is there any reason for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is no timeout added, because the commands themselves take around 5 seconds to even start, so it gives the time necessary for it to work and get synced

@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 🟢 15/03/2022 @Deblintrake09

@damarisg damarisg merged commit 7ca961c into system_test_wazuh_db Mar 15, 2022
@damarisg damarisg deleted the 2508_system_test_assign_agent_with_agent_auth branch March 15, 2022 19:38
@CamiRomero CamiRomero changed the title System Test: Module (WAZUH-DB) - Agent registered with group Y (agent_authd - disconnected) System Test: Module (WAZUH-DB) - Agent registered with group "group_test" (agent_authd - disconnected) Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System Test - Wazuh DB (T0): Agent registered with group Y (agent_authd - disconnected)
3 participants