StarlingX Test tools
Go to file
Andrew Vaillancourt efba994855 Make Python version explicit in Pipfile (3.11)
Defines Python version explicitly to ensure consistent
environments and reduce dependency issues.

Change-Id: I4b00a1cad5029bc51dd336e819b223884ee2ed69
Signed-off-by: Andrew Vaillancourt <andrew.vaillancourt@windriver.com>
2024-12-04 15:31:35 -05:00
config Resource Finder to get full path to resource files 2024-12-02 11:42:37 -05:00
doc New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
framework Updating the test executor to use resource finder for test path 2024-12-03 10:46:39 -05:00
keywords Merge "TESTFramework: DC Sanity - test_dc_system_health_pre_session" 2024-12-04 16:40:38 +00:00
portal New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
pre-commit New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
releasenotes/source [Release Notes] Setup and Build 2019-02-28 07:13:09 -06:00
resources New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
scripts Remove hard coded value for config file 2024-12-02 16:14:07 -05:00
testcases TESTFramework: DC Sanity - test_dc_system_health_pre_session 2024-12-04 13:15:09 -03:00
unit_tests Resource Finder to get full path to resource files 2024-12-02 11:42:37 -05:00
web_pages New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
__init__.py New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
.gitignore New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
.gitreview OpenDev Migration Patch 2019-04-19 19:52:38 +00:00
.pre-commit-config.yaml New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
.zuul.yaml New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
DB_SETUP.txt New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
Pipfile Make Python version explicit in Pipfile (3.11) 2024-12-04 15:31:35 -05:00
Pipfile.lock Make Python version explicit in Pipfile (3.11) 2024-12-04 15:31:35 -05:00
README.rst New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00
tox.ini New StarlingX Automation Framework 2024-11-29 16:01:57 -05:00

stx-test

StarlingX Test repository for automated test cases.

Pre-Requisites ----------

You must have a machine/VM running Ubuntu 22.04 or later
The RunAgent must be able to connect to the internet to pull images and dependencies.
The RunAgent must be able to connect to your labs via SSH.
Download and install Python 3.11, pip and pipenv.
Download and install git on the RunAgent

Contribute

  • Clone the repo
  • Gerrit hook needs to be added for code review purpose.
# Generate a ssh key if needed
ssh-keygen -t rsa -C "<your email address>"
ssh-add $private_keyfile_path

# Add ssh key to settings https://review.opendev.org/#/q/project:starlingx/test
cd <stx-test repo>
git remote add gerrit ssh://<your gerrit username>@review.opendev.org/starlingx/test.git
git review -s

# Create/activate a virtual python environment and pull the project dependencies.
pipenv shell
pipenv sync
  • When you are ready, create your commit with detailed commit message, and submit for review.

Configuration ----------

The framework contains multiple configuration files found under the config folder. There are configurations for docker, hosts, kubernetes, labs and logger. By default, the runner will choose the default config file for each (default.json5) when running. These files can be found under config/<config_type>/files. However, using command line overrides a user can use a custom file. Command line options are --lab_config_file, --k8s_config_file, --logger_config_file, and --docker_config_file.

There are a couple of files that will need to be updated when first setting up.

  1. config/lab/files/default.json5

This file is responsible for holding information such as floating ip, lab type, lab capabilities etc. Adjust the contents of default.json5 to match the information of the lab where you want to execute the test cases. Based on your system type, you can use one of the template files (such as template_simplex.json5) as a starting point. If using a jump server, update the values under config/host/files/jump_host.json5 to use the connection information of the jump server. Then in the lab configuration file, set "use_jump_host: true", and the "jump_server_config:<jump_host_location>" (ex. jump_server_config: "config/host/files/jump_host.json5")

  1. config/docker/files/default.json5

This file is responsible for holding information for docker registries used in testing. Adjust the local registry credentials to match those of the lab where you want to execute the tests.

Update Lab Capabilities Using the lab capability scanner, we can identify common lab capabilities and automatically add them to the configuration. This script will create a backup of the original file and create a new one with the lab capabilities added. These capabilities will help identify which tests are applicable for a given lab setup.

// Run script from the root location of the repo cd <repo_location_root> python scripts/lab_capability_scanner.py --lab_config_file=<lab_config_file>

# (Optional) Install Chrome for Webdriver UI tests
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt -f install            [If you encounter errors during the install]
google-chrome --version        [Verify that the install was successful]

Execution

You are now ready to run some tests!

// From the root repo location we can now run tests cd <repo_location_root> python framework/runner/scripts/test_executor.py --tests_location=<testcase_location>

// Note non-default config locations and filenames are also supported on the commandline as --lab_config_file, --k8s_config_file, --logger_config_file, --docker_config_file python framework/runner/scripts/test_executor.py --tests_location=<testcase_location> --lab_config_file=<config_location>

// Ex. python framework/runner/scripts/test_executor.py --tests_location=testcases/cloud_platform/sanity --lab_config_file=/dev/configs/my_config.json