lib/trento.pm

NAME

Trento test lib

COPYRIGHT

Copyright 2022 SUSE LLC SPDX-License-Identifier: FSFAP

AUTHORS

QE SAP <qe-sap@suse.de>

DESCRIPTION

Package with common methods and default or constant values for Trento tests

Methods

clone_trento_deployment

Clone gitlab.suse.de/qa-css/trento

WORK_DIR - folder where to clone the repo

get_trento_deployment

Get the set of scripts for the Trento deployment

WORK_DIR - folder where to clone the repo

get_resource_group

Return a string to be used as cloud resource group. It contains the JobId

cluster_config

Create a variable map and prepare the qe-sap-deployment using it

PROVIDER - CloudProvider name
REGION - region for the deployment
SCC - SCC_REGCODE

deploy_vm

Deploy the main VM for the Trento application Based on 00.040-trento_vm_server_deploy_azure.sh

WORK_DIR - folder where to clone the repo

trento_acr_azure

Create ACR in Azure and upload from IBS needed images Based on trento_acr_azure.sh

WORK_DIR - folder where to clone the repo

install_trento

Install Trento on the VM. Based on 01.010-trento_server_installation_premium_v.sh

cluster_deploy

Deploy a SAP Landscape using a previously configured qe-sap-deployment

cluster_destroy

Destroy the qe-sap-deployment SAP Landscape

get_vm_name

Return a string to be used as cloud VM name. It contains the JobId

get_acr_name

Return a string to be used as cloud ACR name. It contains the JobId

get_trento_ip

Return the running VM public IP

get_trento_private_ip

Return the private IP of the Trento instance, needed by the agent configuration

get_trento_password

Return the password for the Trento WebUI

az_delete_group

Delete the resource group associated to this JobID and all its content

az_vm_ssh_cmd

Compose ssh command for remote execution on the VM machine. The function optionally accept the VM public IP. If not provided, the IP is calculated on the fly with an az query, take care that is a time consuming az query.

CMD_ARG - String of the command to be executed remotely
VM_IP_ARG - Public IP of the remote machine where to execute the command

cluster_install_agent

Install trento-agent on all the nodes. Installation is performed using ansible.

WORK_DIRECTORY - Working directory, used to eventually download .rpm
PLAYBOOK_LOCATION - Path where to find trento-agent.yaml file
API_KEY - Api key needed to configure trento-agent

k8s_logs

Get all relevant info out from the cluster

CMD_ARG - String of the command to be executed remotely
VM_IP_ARG - Public IP of the remote machine where to execute the command

k8s_test

Test Trento VM and k8s cluster running on it

trento_support

Call trento-support.sh and dump_scenario_from_k8.sh and upload the logs

trento_collect_scenarios

Call dump_scenario_from_k8.sh and upload the logs

trento_api_key

Get the api-key from the Trento installation

BASEDIR - Folder of the trento installer repo clone

cluster_print_cluster_status

Run `crm status` and `SAPHanaSR-showAttr --format=script` on the specified host. Command is executed remotely with Ansible and nothing more (no output collected for further processing)

cluster_hdbadm

Remotly run on $host as user hdbadm

cluster_wait_status

This function allow to wait for a specific output for 'SAPHanaSR-showAttr', on one specific remote host. Remotely runs 'SAPHanaSR-showAttr' on $host. Runs 'SAPHanaSR-showAttr' multiple times in a loop, retying until the output PASS the test 'f_status'. The 'f_status' test is passed as a "function pointer".

Usage example: cluster_wait_status($primary_host, sub { ((shift =~ m/.+UNDEFINED.+SFAIL/) && (shift =~ m/.+PROMOTED.+PRIM/)); });

This one result in SAPHanaSR-showAttr to be called on the HANA PRIMARY until : the line about vmhana01 match with regexp .+UNDEFINED.+SFAIL AND the line about vmhana02 match with regexp .+PROMOTED.+PRIM

HOST - Ansible name or filter for the remote host where to run 'SAPHanaSR-showAttr'
F_STATUS - Function pointer to test the 'SAPHanaSR-showAttr' stdout. Provided function has to support two arguments. `cluster_wait_status` will call the `f_status` passing as first arguments only the output lines of 'SAPHanaSR-showAttr' about the vmhana01, and as second arguments lines about vmhana02
TIMEOUT - Max time to retry. Die if timeout

cluster_wait_status_by_regex

Remotely run 'SAPHanaSR-showAttr' in a loop on $host, wait output that matches regular expression

HOST - Ansible name or filter for the remote host where to run 'SAPHanaSR-showAttr'
TIMEOUT - Max time to retry. Die if timeout
REGULAR_EXPRESSION - Regular expression to match the text to find

cluster_trento_net_peering

Run 00.050 net peering script

podman_self_check

Perform some generic checks related to the podman installation itself and the relevant parameters of the current machine environment.

podman_delete_all

Delete all podman containers with name containing CYPRESS_IMAGE_TAG

podman_wait

Check for status of running container with given name. Polling state until container Status become Exit or timeout. Gently terminate podman in case of timeout. Return the container Exit status.

NAME - Name of the running container used to filter the podman ps
TIMEOUT - Timeout waiting container to exit
CYPRESS_LOG - File used to redirect the cypress console output

podman_exec

Run a command within the running container

NAME - Name of the running container where to exec commands
CMD - command to run within the container

cypress_configs

Prepare all the configuration files for cypress

CYPRESS_TEST_DIR - Cypress test code location.

cypress_install_container

Prepare whatever is needed to run cypress tests using container

cypress_log_upload

Upload to openQA the relevant logs

LOG_FILTER - List of strings. List of file extensions (dot needed)

cypress_exec

Execute a cypress command within the container

CYPRESS_TEST_DIR - String of the path where the cypress Trento code is available. It is the test folder within the path used by setup_jumphost
CMD - String of cmd to be used as main argument for the cypress executable call.
LOG_PREFIX - String of the command to be executed remotely
TIMEOUT - Integer used as timeout for the cypress command execution

cypress_test_exec

Execute a set of cypress tests. Execute, one by one, all tests in all .js files in the provided folder.

CYPRESS_TEST_DIR - String of the path where the cypress Trento code is available. It is the test folder within the path used by setup_jumphost
TEST_TAG - String of the test subfolder within $cypress_test_dir/cypress/integration Also used as tag for each test result file
TIMEOUT - Integer used as timeout for the internal cypress_exec call