Skip to content

Commit

Permalink
Update readme regarding --preserve-installers switch (#54)
Browse files Browse the repository at this point in the history
* Update readme regarding --preserve-installers switch
* Add documentation on how to list and download installers with specific version
  • Loading branch information
WStechura authored Dec 11, 2024
1 parent a412454 commit 3ff5fb7
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion roles/oneagent/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ local deployment are specified or any other platforms is used along with local o
- venv 20.0+
-
## Running tests

### Preparing test environment

Upon downloading the collection

```commandline
```console
# Install dependencies
$ apt-get install -y python3-venv python3-pip sshpass

Expand All @@ -43,11 +46,38 @@ $ pip install -r roles/oneagent/tests/requirements.txt
$ mkdir -p roles/oneagent/files && wget https://ca.dynatrace.com/dt-root.cert.pem -P roles/oneagent/files
$ ansible-galaxy collection build . -vvv
$ sudo bash -c "source venv/bin/activate && ansible-galaxy collection install -vvv dynatrace-oneagent*"
```

### Running tests locally and remotely

Running tests with regular manner requires one of the following commands:

```console
# Run tests for any platform (except from Windows) on local machine
$ sudo bash -c "source venv/bin/activate && pytest roles/oneagent/tests --linux_x86=localhost"

# Run tests with regular installer on remote Windows machine
$ sudo bash -c "source venv/bin/activate && pytest roles/oneagent/tests --user=<USER> --password=<password> \
--tenant=https://abc123456.com --tenant_token=<TOKEN> --windows_x86=<IP>"
```

There is also an option to run tests with placed-in installers using `--preserve-installers` switch.
In this mode, the test environment won't be fully cleaned. It requires that both installers differs in version and have
the naming schema from tenant, e.g. `Dynatrace-OneAgent-Linux-1.301.0.sh`, `Dynatrace-OneAgent-Linux-arm-1.302.0.sh`.
Also, the installers certificate must be downloaded for successful run. </br>
You can refer to [this documentation](https://docs.dynatrace.com/docs/shortlink/api-deployment-get-versions) on how to
list available installers.
For downloading the specific version of the OneAgent, visit
[this documentation](https://docs.dynatrace.com/docs/shortlink/api-deployment-get-oneagent-version). </br>
To run tests in this mode, download 2 versions of installers you want along with the certificate and place them in
`test_dir/installers` directory. Then, you can run the tests.

```console
# Create directory `test_dir/installers` and place the installers and certificate in it
$ mkdir -p test_dir/installers
$ cp /path/and/name/of/both/installers test_dir/installers
$ wget https://ca.dynatrace.com/dt-root.cert.pem -P test_dir/installers

# Run tests on local machine
$ sudo bash -c "source venv/bin/activate && pytest roles/oneagent/tests --linux_x86=localhost --preserve_installers"
```

0 comments on commit 3ff5fb7

Please sign in to comment.