wazuh / qa-system-framework

GNU General Public License v2.0
1 stars 3 forks source link

Improve QA Framework to allow Sytem test automation #35

Closed Rebits closed 4 months ago

Rebits commented 1 year ago

Description

With the development of pipelines capable of deploying E2E Wazuh environments, it becomes necessary to incorporate system tests into CI processes. Currently, system tests use docker environments to deploy managers and agents. This approach makes it impossible to automate pipelines in a scalable way, furthermore, it performs test configuration within the provisioning process, which unequivocally links environments with specific tests making it impossible to reuse those environments.

Given this need, we need to create a framework capable of managing the operations of the current system tests in a fast and intuitive way. In addition, it should also support Windows/macOS/Solaris systems.

flowchart TB
    subgraph Jenkins
    A[WazuhQAEnvironment] --> |Deployment&Provision| B[EnvironmentInventory]
    end
    subgraph pytest
    C[System Tests] -->  B[EnvironmentInventory] --> D[WazuhHandler] --> Report
    end

Design

We propose the development of a new class WazuhHandler. This class will inherit from the already defined HostManager. HostManager class will be responsible only for low-level operations (files and process handling). WazuhHandler instead, will handle the environment at a high level (Wazuh configuration, API requests, Agent removal, etc).

classDiagram
HostManager <|-- WazuhHandler
    class HostManager{
        +Map move_file
        +Map create_file
        +Map modify_file_content
        +Map truncate_file
        +Map remove_file
        +Map run_command
        +Map run_shell
        +Map find_file
        +Map get_hot_ip
    }
    class WazuhHandler{
        +Map configure_environment
        +Map set_manager_agent_configuration
        +Map get_configuration_path
        +Map get_log_path
        +Map create_local_internal_configuration
        +Map log_search
        +Map is_windows
        +Map is_linux
        +Map get_host_variables
        +Map get_managers
        +Map get_agents
        +Map get_hosts
        +Map restart_agents
        +Map get_agents_id
        +Map restart_managers
        +Map make_api_call
        +Map clean_agents
    }

Summarizing, this new class should be able to execute the following basic operations of an environment:

It is important to highlight that all the class methods should:

To Do

davidjiglesias commented 4 months ago

To be evaluated as part of Wazuh packages redesign tier 2