wazuh / wazuh-qa

Wazuh - Quality Assurance
GNU General Public License v2.0
60 stars 30 forks source link

Adding basic_info and connection validations #5268

Closed pro-akim closed 2 weeks ago

pro-akim commented 2 weeks ago

Adding granularity to tests

It was included:

Some additional validation in arch, installation os version, port and processes were added

pro-akim commented 2 weeks ago

Update

TEST

YAML file ``` version: 0.1 description: This workflow is used to test agents' deployment for DDT1 PoC variables: agent-os: - linux-oracle-9-amd64 - linux-centos-7-amd64 - linux-centos-8-amd64 - linux-redhat-7-amd64 - linux-redhat-8-amd64 - linux-redhat-9-amd64 - linux-amazon-2-amd64 manager-os: linux-ubuntu-22.04-amd64 infra-provider: vagrant working-dir: /tmp/dtt1-poc tasks: # Unique manager allocate task - task: "allocate-manager-{manager-os}" description: "Allocate resources for the manager." do: this: process with: path: python3 args: - modules/allocation/main.py - action: create - provider: "{infra-provider}" - size: large - composite-name: "{manager-os}" - inventory-output: "{working-dir}/manager-{manager-os}/inventory.yaml" - track-output: "{working-dir}/manager-{manager-os}/track.yaml" - label-termination-date: "1d" - label-team: "qa" on-error: "abort-all" cleanup: this: process with: path: python3 args: - modules/allocation/main.py - action: delete - track-output: "{working-dir}/manager-{manager-os}/track.yaml" # Unique agent allocate task - task: "allocate-agent-{agent}" description: "Allocate resources for the agent." do: this: process with: path: python3 args: - modules/allocation/main.py - action: create - provider: "{infra-provider}" - size: small - composite-name: "{agent}" - inventory-output: "{working-dir}/agent-{agent}/inventory.yaml" - track-output: "{working-dir}/agent-{agent}/track.yaml" - label-termination-date: "1d" - label-team: "qa" foreach: - variable: agent-os as: agent cleanup: this: process with: path: python3 args: - modules/allocation/main.py - action: delete - track-output: "{working-dir}/agent-{agent}/track.yaml" depends-on: - "provision-manager-{manager-os}" # Unique manager provision task - task: "provision-manager-{manager-os}" description: "Provision the manager." do: this: process with: path: python3 args: - modules/provision/main.py - inventory: "{working-dir}/manager-{manager-os}/inventory.yaml" - install: - component: wazuh-manager type: assistant version: 4.7.3 live: True depends-on: - "allocate-manager-{manager-os}" # Generic agent test task - task: "run-agent-{agent}-tests" description: "Run tests install for the agent {agent}." do: this: process with: path: python3 args: - modules/testing/main.py - targets: - wazuh-1: "{working-dir}/manager-{manager-os}/inventory.yaml" - agent: "{working-dir}/agent-{agent}/inventory.yaml" - tests: "install,registration,connection,basic_info,restart,stop,uninstall" - component: "agent" - wazuh-version: "4.7.3" - wazuh-revision: "40714" - live: "True" foreach: - variable: agent-os as: agent depends-on: - "allocate-agent-{agent}" ```

Results

In CentOS connection and restart testing

[2024-04-16 15:09:36,184] [ERROR] [Testing]: Port is closed
[2024-04-16 15:10:12,461] [ERROR] [Testing]: Port is closed

In redhat7,8 and 9 basic_info

[2024-04-16 15:14:15,710] [ERROR] [Testing]: There is a mismatch between the OS version and the OS version of the installed agent
[2024-04-16 15:18:41,710] [ERROR] [Testing]: There is a mismatch between the OS version and the OS version of the installed agent
[2024-04-16 15:22:32,676] [ERROR] [Testing]: There is a mismatch between the OS version and the OS version of the installed agent

Centos-7 is not showing its port status correctly => Centos7 in vagrant does not have lsof. it was replaced by ss redhat-7,8 and 9 seems to unmatch the obtained os name => fixed, validations required remove empty spaces in the naming