Skip to content

Commit

Permalink
fix(#5229): Fixing validations in basic_info
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Apr 22, 2024
1 parent 6d22b61 commit 1e32d4d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deployability/modules/testing/tests/helpers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def register_agent(inventory_path, manager_path):
assert host_ip in Executor.execute_command(inventory_path, f'cat {WAZUH_CONF}'), logger.error(f'Error configuring the Manager IP ({host_ip}) in: {HostInformation.get_os_name_and_version_from_inventory(inventory_path)} agent')

elif os_type == 'macos':
host_ip = HostInformation.get_public_ip_from_aws_dns(host) if 'amazonaws' in host else host
host_ip = HostInformation.get_internal_ip_from_aws_dns(host) if 'amazonaws' in host else HostInformation.get_public_ip_from_aws_dns(host)
commands = [
f"sed -i '.bak' 's/<address>MANAGER_IP<\/address>/<address>{host_ip}<\/address>/g' /Library/Ossec/etc/ossec.conf",
"/Library/Ossec/bin/wazuh-control restart"
Expand Down
4 changes: 2 additions & 2 deletions deployability/modules/testing/tests/helpers/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ def get_os_name_and_version_from_inventory(inventory_path) -> tuple:
@staticmethod
def get_os_version_from_inventory(inventory_path) -> str:
if 'manager' in inventory_path:
os_version = re.search(r".*?/manager-linux-.*?-(.*?)-.*?/inventory.yaml", inventory_path).group(1)
os_version = re.search(r".*?/manager-.*?-.*?-(.*?)-.*?/inventory.yaml", inventory_path).group(1)
elif 'agent' in inventory_path:
os_version = re.search(r".*?/agent-linux-.*?-(.*?)-.*?/inventory.yaml", inventory_path).group(1)
os_version = re.search(r".*?/agent-.*?-.*?-(.*?)-.*?/inventory.yaml", inventory_path).group(1)
return os_version
else:
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def setup_test_environment(wazuh_params):
def test_wazuh_os_version(wazuh_params):
wazuh_api = WazuhAPI(wazuh_params['master'])
for agent_names, agent_params in wazuh_params['agents'].items():
assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(agent_params)}')
if HostInformation.get_os_type(agent_params) == 'linux':
assert HostInformation.dir_exists(agent_params, WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(agent_params)}')
elif HostInformation.get_os_type(agent_params) == 'macos':
assert HostInformation.dir_exists(agent_params, '/Library/Ossec'), logger.error(f'The /Library/Ossec is not present in {HostInformation.get_os_name_and_version_from_inventory(agent_params)}')

expected_condition_func = lambda: 'active' == WazuhAgent.get_agent_status(wazuh_api, agent_names)
Waits.dynamic_wait(expected_condition_func, cycles=20, waiting_time=30)
assert HostInformation.get_os_version_from_inventory(agent_params) in WazuhAgent.get_agent_os_version_by_name(wazuh_api, agent_names), logger.error('There is a mismatch between the OS version and the OS version of the installed agent')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ version: 0.1
description: This workflow is used to test agents' deployment for DDT1 PoC
variables:
agent-os:
- macos-sonoma-14.0-arm64
- linux-ubuntu-18.04-amd64
- macos-sonoma-14.3-arm64
manager-os: linux-ubuntu-22.04-amd64
infra-provider: vagrant
infra-provider: aws
working-dir: /tmp/dtt1-poc

tasks:
Expand All @@ -26,7 +25,6 @@ tasks:
- track-output: "{working-dir}/manager-{manager-os}/track.yaml"
- label-termination-date: "1d"
- label-team: "qa"
- ssh-key: "/home/akim/Desktop/personal/Ephemeral"
on-error: "abort-all"
cleanup:
this: process
Expand Down Expand Up @@ -101,7 +99,7 @@ tasks:
- targets:
- wazuh-1: "{working-dir}/manager-{manager-os}/inventory.yaml"
- agent: "{working-dir}/agent-{agent}/inventory.yaml"
- tests: "install,registration,restart,stop,uninstall"
- tests: "install,registration,basic_info,connection,restart,stop,uninstall"
- component: "agent"
- wazuh-version: "4.7.3"
- wazuh-revision: "40714"
Expand Down

0 comments on commit 1e32d4d

Please sign in to comment.