Skip to content

Commit

Permalink
docs: update IT README
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebits committed Dec 7, 2023
1 parent dd8ca0f commit ad89b4e
Showing 1 changed file with 51 additions and 91 deletions.
142 changes: 51 additions & 91 deletions tests/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ tests modify the system date and there could be some synchronization issues.

This guide will cover the following platforms: [Linux](#linux), [Windows](#windows) and [MacOS](#macos).

You can run these tests on a manager or an agent. In case you are using an agent, please remember to register it and use
the correct version (Wazuh branch).
You can run these tests on a manager or an agent. In case you are using an agent, please remember to register it and use the correct version (Wazuh branch).

_We are skipping Wazuh installation steps. For further information,
check [Wazuh documentation](https://documentation.wazuh.com/3.11/installation-guide/index.html)._
check [Wazuh documentation](https://documentation.wazuh.com/current/installation-guide/index.html)._

### Linux

_We are using **CentOS** for this example:_

- Install **Wazuh**
- Install and start **Wazuh**

> [!NOTE]:
> In case you are using an agent, please remember to register to the manager
- Disable firewall (only for **CentOS**)

Expand All @@ -32,41 +34,42 @@ systemctl stop firewalld
systemctl disable firewalld
```

- Install Python and its dependencies

- Install development dependencies for jq library
```shell script
# Install dependencies
yum install make gcc policycoreutils-python automake autoconf libtool epel-release git which sudo wget -y

# Install development dependencies for jq library
yum groupinstall "Development Tools" -y
```

# Install Python3
- Install Python3
```sheel script
yum install python36 python36-pip python36-devel -y

# Install Python libraries
pip3 install pytest freezegun jq jsonschema pyyaml==5.3 psutil distro pandas==0.25.3 pytest-html==2.0.1 numpydoc==0.9.2
```

- Add some internal options and restart
- Install integration tests dependencies

```shell script
# Enable debug 2
echo 'syscheck.debug=2' >> $wazuh_path/etc/local_internal_options.conf

# Avoid agent disconnections when travelling in time (only for agents)
sed -i "s:<time-reconnect>60</time-reconnect>:<time-reconnect>99999999999</time-reconnect>:g" /var/ossec/etc/ossec.conf
cd wazuh-qa
python -m pip install -r requirements.txt
```

# Disable log rotation
echo 'monitord.rotate_log=0' >> $wazuh_path/etc/local_internal_options.conf
- Install wazuh-testing framework
```shell script
cd deps/wazuh_testing/
python setup.py install
```

# Restart Wazuh
/var/ossec/bin/wazuh-control restart
> [!NOTE]:
> In case of development of tests, we can use the following command in order to update the framework for each change
```
python -m pip install . -e
```


### Windows

- Install **Wazuh**
- Install and start **Wazuh**

> [!NOTE]:
> In case you are using an agent, please remember to register to the manager
- Download and install [Python](https://www.python.org/downloads/windows/)

Expand All @@ -79,68 +82,49 @@ echo 'monitord.rotate_log=0' >> $wazuh_path/etc/local_internal_options.conf
choco install jq
```

- Install Python dependencies
- Install integration tests dependencies

```shell script
pip install pytest freezegun jsonschema pyyaml==5.4 psutil paramiko distro pywin32 pypiwin32 wmi pandas==0.25.3 pytest-html==2.0.1 numpydoc==0.9.2
```

- Change `time-reconnect` from `C:\Program Files (x86)\ossec-agent\ossec.conf`

```xml
<time-reconnect>99999999999</time-reconnect>
cd wazuh-qa
python -m pip install -r requirements.txt
```

- Add some internal options

- Install wazuh-testing framework
```shell script
# Enable debug 2
echo 'syscheck.debug=2' >> "C:\Program Files (x86)\ossec-agent\local_internal_options.conf"

# Disable log rotation
echo 'monitord.rotate_log=0' >> "C:\Program Files (x86)\ossec-agent\local_internal_options.conf"
cd deps/wazuh_testing/
python setup.py install
```

- Restart **Wazuh** using the GUI
> [!NOTE]:
> In case of development of tests, we can use the following command in order to update the framework for each change
```
python -m pip install . -e
```

### MacOS

- Install **Wazuh**
- Install and start **Wazuh**

- Install Python and its dependencies
> [!NOTE]:
> Remember to register the agent to the manager
```shell script
# Install Python
```shell script
brew install python3

# Install dependencies
brew install autoconf automake libtool

# Install Python libraries
pip3 install filetype freezegun jq jsonschema lockfile numpydoc psutil pytest-html pytest-testinfra pyyaml
```

- Add some internal options and restart
- Install Python and its dependencies

```shell script

# Enable debug 2
echo 'syscheck.debug=2' >> /Library/Ossec/etc/local_internal_options.conf

# Avoid agent disconnections when travelling in time
brew install gnu-sed
gsed -i "s:<time-reconnect>60</time-reconnect>:<time-reconnect>99999999999</time-reconnect>:g" /Library/Ossec/etc/ossec.conf

# Disable log rotation
echo 'monitord.rotate_log=0' >> /Library/Ossec/etc/local_internal_options.conf

# Restart Wazuh
/Library/Ossec/bin/wazuh-control restart
cd wazuh-qa
python -m pip install -r requirements.txt
```

-----------

Finally, copy your `wazuh-qa` repository within your testing environment and you are set.
- Install wazuh-testing framework
```shell script
cd deps/wazuh_testing/
python setup.py install
```

## Integration tests

Expand Down Expand Up @@ -276,15 +260,6 @@ generate **three** different configurations. One for each _WILDCARD_ value.

This will be our python module with all the needed code to test everything.

### Dependencies

To run them, we need to install all these Python dependencies:

```shell script
pip3 install distro freezegun jq jsonschema psutil pytest pyyaml==5.3 pandas==0.25.3 pytest-html==2.0.1 numpydoc==0.9.2
```

_**NOTE:** `jq` library can only be installed with `pip` on **Linux**_

### Wazuh-Testing package

Expand Down Expand Up @@ -350,21 +325,6 @@ Folder with all the general tools that could be used in every test. They are gro

- **Time**: classes and functions to 'travel in time' (needed for scheduled monitoring) and manage dates.

To install it:

```shell script
cd wazuh-qa/deps/wazuh_testing
pip3 install .
```

_**NOTE:** It is important to reinstall this package every time we modify anything
from `wazuh-qa/packages/wazuh_testing`_

```shell script
cd wazuh-qa/deps/wazuh_testing
pip3 uninstall -y wazuh_testing && pip3 install .
```

### Pytest

We use [pytest](https://docs.pytest.org/en/latest/contents.html) to run our integrity tests. Pytest will recursively
Expand Down

0 comments on commit ad89b4e

Please sign in to comment.