From dad22ee05703b0c84873858a5cd47806834fc8e3 Mon Sep 17 00:00:00 2001 From: "wojciech.stechura" Date: Fri, 6 Dec 2024 08:24:20 +0100 Subject: [PATCH 1/3] Update readme regarding --preserve-installers switch --- roles/oneagent/tests/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/roles/oneagent/tests/README.md b/roles/oneagent/tests/README.md index 70ac55a..f1669ab 100644 --- a/roles/oneagent/tests/README.md +++ b/roles/oneagent/tests/README.md @@ -26,6 +26,9 @@ 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 @@ -43,7 +46,13 @@ $ 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: + +```commandline # 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" @@ -51,3 +60,20 @@ $ sudo bash -c "source venv/bin/activate && pytest roles/oneagent/tests --linux_ $ sudo bash -c "source venv/bin/activate && pytest roles/oneagent/tests --user= --password= \ --tenant=https://abc123456.com --tenant_token= --windows_x86=" ``` + +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.
+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. + +```commandline +# 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" +``` From 34fbf4c674a9fceb312883d6dd7e2b12a37ad14a Mon Sep 17 00:00:00 2001 From: "wojciech.stechura" Date: Fri, 6 Dec 2024 10:28:34 +0100 Subject: [PATCH 2/3] Apply review remarks --- roles/oneagent/tests/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/oneagent/tests/README.md b/roles/oneagent/tests/README.md index f1669ab..b5c2a93 100644 --- a/roles/oneagent/tests/README.md +++ b/roles/oneagent/tests/README.md @@ -31,7 +31,7 @@ local deployment are specified or any other platforms is used along with local o Upon downloading the collection -```commandline +```console # Install dependencies $ apt-get install -y python3-venv python3-pip sshpass @@ -52,7 +52,7 @@ $ sudo bash -c "source venv/bin/activate && ansible-galaxy collection install -v Running tests with regular manner requires one of the following commands: -```commandline +```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" @@ -68,7 +68,7 @@ Also, the installers certificate must be downloaded for successful run.
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. -```commandline +```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 From 35146e34e3599e1a9324151da81cda4d18f4de43 Mon Sep 17 00:00:00 2001 From: "wojciech.stechura" Date: Tue, 10 Dec 2024 14:05:36 +0100 Subject: [PATCH 3/3] Add documentation on how to list and download installers with specific version --- roles/oneagent/tests/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/oneagent/tests/README.md b/roles/oneagent/tests/README.md index b5c2a93..7e49db4 100644 --- a/roles/oneagent/tests/README.md +++ b/roles/oneagent/tests/README.md @@ -65,6 +65,10 @@ There is also an option to run tests with placed-in installers using `--preserve 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.
+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).
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.