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

Adding basic_info and connection validations #5225

Closed

Conversation

pro-akim
Copy link
Member

@pro-akim pro-akim commented Apr 16, 2024

Adding granularity to tests

It was included:

  • basic_info
  • connection

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

@pro-akim
Copy link
Member Author

pro-akim commented Apr 16, 2024

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

Copy link
Member

@fcaffieri fcaffieri left a comment

Choose a reason for hiding this comment

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

GJ, some minor fixes

from ..helpers.agent import WazuhAgent, WazuhAPI
from ..helpers.constants import WAZUH_ROOT
from ..helpers.generic import HostConfiguration, HostInformation, GeneralComponentActions, Waits
from ..helpers.logger.logger import logger
Copy link
Member

@fcaffieri fcaffieri Apr 18, 2024

Choose a reason for hiding this comment

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

Suggested change
from ..helpers.logger.logger import logger
from modules.generic.logger import logger

We need to implement logger with the new fixes

Copy link
Member Author

@pro-akim pro-akim Apr 18, 2024

Choose a reason for hiding this comment

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

The new logger is from modules.generic.logger import logger.
Fixed after merging new changes

from ..helpers.agent import WazuhAgent, WazuhAPI
from ..helpers.generic import HostInformation, GeneralComponentActions, Waits
from ..helpers.manager import WazuhManager, WazuhAPI
from ..helpers.logger.logger import logger
Copy link
Member

@fcaffieri fcaffieri Apr 18, 2024

Choose a reason for hiding this comment

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

Suggested change
from ..helpers.logger.logger import logger
from modules.generic.logger import logger

Same

Copy link
Member Author

@pro-akim pro-akim Apr 18, 2024

Choose a reason for hiding this comment

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

The new logger is from modules.generic.logger import logger.
Fixed after merging new changes

@pro-akim pro-akim requested a review from fcaffieri April 18, 2024 13:52
@pro-akim pro-akim force-pushed the 4495-dtt1-release branch from 78b1755 to 81dccd5 Compare April 18, 2024 14:07
@pro-akim pro-akim force-pushed the fix/5215-Adding-granularity-agent-tests branch 6 times, most recently from 56bf9da to 5603e91 Compare April 18, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants