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

Add wpk test documentation #2409

Merged
merged 17 commits into from
Jan 27, 2022
Merged

Add wpk test documentation #2409

merged 17 commits into from
Jan 27, 2022

Conversation

MizugorouZ
Copy link
Contributor

Related issue
Closes #1821

Description

As part of epic #1796, this PR adds the missing documentation and migrates the current documentation to the new format used by QA Docs.
The schema used is the one defined in issue #1694

Generated documentation

test_wpk

test_wpk_agent.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <info@wazuh.com>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "Prepare the agent to upgrade usign WPK packages, checking the expected messeges are correct.",
    "tier": 0,
    "modules": [
        "wpk"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-authd",
        "wazuh-remoted"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/development/packaging/generate-wpk-package.html"
    ],
    "pytest_args": [
        {
            "wpk_version": "Specify the version to upgrade"
        },
        {
            "wpk_package_path": "Specify the path to the wpk package"
        }
    ],
    "tags": [
        "wpk"
    ],
    "name": "test_wpk_agent.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_wpk/test_wpk_agent.py",
    "tests": [
        {
            "description": "Prepare the agent to upgrade usign WPK packages, checking the expected messeges are correct.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "prepare_agent_version": {
                        "type": "fixture",
                        "brief": "Prepare the initial agent version to match the expected."
                    }
                },
                {
                    "download_wpk": {
                        "type": "fixture",
                        "brief": "Download the WPK package to upgrade the agent."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "start_agent": {
                        "type": "fixture",
                        "brief": "Start the agent, as well as the remoted and authd simulators."
                    }
                }
            ],
            "assertions": [
                "Verify that initial agent version matches the expected",
                "Verify the successful upgrade proccess",
                "Verify the upgrade result code is the expected or the error message is the expected",
                "Verify notification status was the expected",
                "Verify the end version matches the expected"
            ],
            "input_description": null,
            "expected_output": [
                "r'Upgrade process result'",
                "r'Upgrade result code'",
                "r'Notification status'",
                "r'End version'"
            ],
            "tags": [
                "wpk"
            ],
            "name": "test_wpk_agent"
        }
    ]
}

test_wpk_manager.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <info@wazuh.com>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "Prepare an environment with different agents to test WPK upgrade, with different scenarios containing agents already updated, agents that can not be updated, repository not reachable, disconected agents...",
    "tier": 0,
    "modules": [
        "wpk"
    ],
    "components": [
        "manager",
        "agent"
    ],
    "daemons": [
        "wazuh-authd",
        "wazuh-csyslogd",
        "wazuh-execd",
        "wazuh-logcollector",
        "wazuh-monitord",
        "wazuh-remoted",
        "wazuh-syscheckd",
        "wazuh-clusterd",
        "wazuh-modulesd",
        "wazuh-db"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/development/packaging/generate-wpk-package.html"
    ],
    "pytest_args": [
        {
            "wpk_version": "Specify the version to upgrade"
        },
        {
            "wpk_package_path": "Specify the path to the wpk package"
        }
    ],
    "tags": [
        "wpk"
    ],
    "name": "test_wpk_manager.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_wpk/test_wpk_manager.py",
    "tests": [
        {
            "description": "Prepare an environment with different agents to test WPK upgrade, with different scenarios containing agents already updated, agents that can not be updated, repository not reachable, disconected agents...",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "set_debug_mode": {
                        "type": "fixture",
                        "brief": "Sets the debug mode in the manager."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_service": {
                        "type": "fixture",
                        "brief": "Restarts Wazuh manager."
                    }
                },
                {
                    "configure_agents": {
                        "type": "fixture",
                        "brief": "Configure all simulated agents."
                    }
                }
            ],
            "assertions": [
                "Verify that version and HTTP are the expected",
                "Verify that successful upgrade proccess",
                "Verify the first attemp is successful",
                "Verify the results are the expected"
            ],
            "input_description": null,
            "expected_output": [
                "r'Upgrade process result'"
            ],
            "tags": [
                "wpk"
            ],
            "name": "test_wpk_manager"
        }
    ]
}

test_manager_task_states.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <info@wazuh.com>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "Register agents in the manager and test upgrading them through a command, which will made the agent to upgrade using WPK packages.",
    "tier": 0,
    "modules": [
        "wpk"
    ],
    "components": [
        "manager"
    ],
    "daemons": [
        "wazuh-authd",
        "wazuh-csyslogd",
        "wazuh-execd",
        "wazuh-logcollector",
        "wazuh-monitord",
        "wazuh-remoted",
        "wazuh-syscheckd",
        "wazuh-clusterd",
        "wazuh-modulesd",
        "wazuh-db"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/development/packaging/generate-wpk-package.html"
    ],
    "pytest_args": [
        {
            "wpk_version": "Specify the version to upgrade"
        },
        {
            "wpk_package_path": "Specify the path to the wpk package"
        }
    ],
    "tags": [
        "wpk"
    ],
    "name": "test_wpk_manager_task_states.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_wpk/test_wpk_manager_task_states.py",
    "tests": [
        {
            "description": "Register agents in the manager and test upgrading them through a command, which will made the agent to upgrade using WPK packages.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_service": {
                        "type": "fixture",
                        "brief": "Restarts Wazuh manager."
                    }
                },
                {
                    "configure_agents": {
                        "type": "fixture",
                        "brief": "Configure all simulated agents."
                    }
                }
            ],
            "assertions": [
                "Verify that the first attemp is success",
                "Verify the upgrade status matches the expected",
                "Verify the upgrade status after restarting",
                "Verify the upgrade response matches the expected"
            ],
            "input_description": null,
            "expected_output": [
                "r'Upgrade process result'"
            ],
            "tags": [
                "wpk"
            ],
            "name": "test_wpk_manager_task_states",
            "inputs": [
                "get_configuration0",
                "get_configuration1",
                "get_configuration2",
                "get_configuration3",
                "get_configuration4"
            ]
        }
    ]
}

Tests

  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py.
  • The DocGenerator sanity check test does not return errors. python3 DocGenerator.py -s

mdengra and others added 11 commits August 31, 2021 15:01
The scheme of proposal 3 has been used until the definitive one is available.
Update DocGenerator/config.yaml
PEP-8 fixes

Closes: #1801
The following tests have been documented:
  * test_agentd_state.py
  * test_agentd_state_config.py
The scheme of proposal 3 has been used until the definitive one is available.
Update DocGenerator/config.yaml
PEP-8 fixes

Closes: #1801
Migrate `test_agentd` documentation to QA Docs
The scheme of proposal 3 has been used until the definitive one is available.
PEP-8 fixes

Closes: #1599
…esponse

Migrate `test_active_response` documentation to QA Docs
…documentation in QA Docs style

The following tests have been documented:
  * test_check_rare_socket_responses.py
  * test_check_socket_responses.py
  * test_validate_linux_analysisd_alerts.py
  * test_validate_rare_analysisd_alerts.py
  * test_validate_win32_analysisd_alerts.py
  * test_validate_win32_analysisd_registry_alerts.py
The scheme of proposal 3 has been used until the definitive one is available.
Update DocGenerator/config.yaml
PEP-8 fixes

Closes: #1804
The following tests have been documented:
  * test_error_messages/test_error_messages.py
  * test_event_messages/test_event_messages.py
  * test_integrity_messages/test_integrity_messages.py
  * test_analysisd/test_scan_messages/test_scan_messages.py
Migrated test_mitre/test_mitre_check_alert.py
The scheme of proposal 3 has been used until the definitive one is available.
PEP-8 fixes

Closes: #1804
Migrate `test_analysisd` documentation to QA Docs
Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

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

GJ, but some changes are required

tests/integration/test_wpk/test_wpk_agent.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_agent.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_agent.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager.py Outdated Show resolved Hide resolved
Comment on lines 10 to 12
brief: Register agents in the manager and test upgrading
them through a command, which will made the agent
to upgrade using WPK packages.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
brief: Register agents in the manager and test upgrading
them through a command, which will made the agent
to upgrade using WPK packages.
brief: Register agents in the manager and test upgrading
them through a command, which will make the agent
to upgrade using WPK packages.

Comment on lines 274 to 276
description: Register agents in the manager and test upgrading
them through a command, which will made the agent
to upgrade using WPK packages.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description: Register agents in the manager and test upgrading
them through a command, which will made the agent
to upgrade using WPK packages.
description: Register agents in the manager and test upgrading
them through a command, which will make the agent
to upgrade using WPK packages.

tests/integration/test_wpk/test_wpk_manager_task_states.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager_task_states.py Outdated Show resolved Hide resolved
Copy link
Member

@Rebits Rebits 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 changes are required

tests/integration/test_wpk/test_wpk_agent.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_agent.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager_task_states.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager_task_states.py Outdated Show resolved Hide resolved
tests/integration/test_wpk/test_wpk_manager_task_states.py Outdated Show resolved Hide resolved
@Rebits Rebits changed the base branch from 1796-migrate-doc-schema-2 to master January 17, 2022 08:46
Rebits
Rebits previously approved these changes Jan 17, 2022
Copy link
Member

@Rebits Rebits left a comment

Choose a reason for hiding this comment

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

LGTM

@snaow snaow merged commit 92a8bfe into master Jan 27, 2022
@snaow snaow deleted the 1821-migrate-doc-wpk branch January 27, 2022 18:16
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.

QA Docs: Migrate test_wpk documentation to schema 1.0
5 participants