Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 6. Running containerized Tempest
This section contains information about running tempest from a container on the undercloud. You can run tempest against the overcloud or the undercloud. Containerized tempest requires the same resources as non-containerized tempest.
6.1. Preparing the Tempest container Copier lienLien copié sur presse-papiers!
Complete the following steps to download and configure your tempest container:
Change to the
/home/stackdirectory:cd /home/stack
$ cd /home/stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Download the tempest container:
podman pull registry.redhat.io/rhosp15-rhel8/openstack-tempest
$ podman pull registry.redhat.io/rhosp15-rhel8/openstack-tempestCopy to Clipboard Copied! Toggle word wrap Toggle overflow This container includes all tempest plugins. Running tempest tests globally with this container includes tests for plugins. For example, if you run the
tempest run --regex '(*.)'command, tempest runs all plugin tests. These tempest tests fail if your deployment does not contain configuration for all plugins. Run thetempest list-pluginscommand to view all installed plugins. To exclude tests, you must include the tests that you want to exclude in a blacklist file. For more information, see Chapter 5, Using Tempest.Create directories to use for exchanging data between the host machine and the container:
mkdir container_tempest tempest_workspace
$ mkdir container_tempest tempest_workspaceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the necessary files to the
container_tempestdirectory. This directory is the file source for the container:cp stackrc overcloudrc tempest-deployer-input.conf container_tempest
$ cp stackrc overcloudrc tempest-deployer-input.conf container_tempestCopy to Clipboard Copied! Toggle word wrap Toggle overflow List the available container images:
podman images
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.redhat.io/rhosp15-rhel8/openstack-tempest latest 881f7ac24d8f 10 days ago 641 MBCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create an alias to facilitate easier command entry. Ensure that you use absolute paths when mounting the directories:
alias podman-tempest="podman run -i \ -v "$(pwd)"/container_tempest:/home/stack/container_tempest \ -v "$(pwd)"/tempest_workspace:/home/stack/tempest_workspace \ registry.redhat.io/rhosp15-rhel8/openstack-tempest \ /bin/bash"$ alias podman-tempest="podman run -i \ -v "$(pwd)"/container_tempest:/home/stack/container_tempest \ -v "$(pwd)"/tempest_workspace:/home/stack/tempest_workspace \ registry.redhat.io/rhosp15-rhel8/openstack-tempest \ /bin/bash"Copy to Clipboard Copied! Toggle word wrap Toggle overflow To get a list of available tempest plugins in the container, run the following command:
podman-tempest -c "rpm -qa | grep tempest"
$ podman-tempest -c "rpm -qa | grep tempest"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2. Running containerized Tempest inside the container Copier lienLien copié sur presse-papiers!
Create a tempest script that you can execute within the container to generate the
tempest.conffile and run the tempest tests. The script performs the following actions:-
Set the exit status for the command
set -e. -
Source the
overcloudrcfile if you want to run tempest against the overcloud. Source thestackrcfile if you want to run tempest against the undercloud. -
Run
tempest initto create a tempest workspace. Use the shared directory so that the files are also accessible from the host. -
Change directory to
tempest_workspace - Export the TEMPESTCONF environment variable for ease of use at a later stage.
-
Execute
discover-tempest-configto generate thetempest.conffile. For more information about the options that you can include in thediscover-tempest-configcommand, rundiscover-tempest-config --help. -
Set
--outtohome/stack/tempest_workspace/tempest.confso that thetempest.conffile is accessible from the host machine. -
Set
--deployer-inputto point to thetempest-deployer-input.conffile in the shared directory. Run tempest tests. This example script runs the smoke test
tempest run --smoke.Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you already have a
tempest.conffile and you want only to run the tempest tests, omitTEMPESTCONFfrom the script and replace it with a command to copy yourtempest.conffile from thecontainer_tempestdirectory to thetempest_workspace/etcdirectory:
cp /home/stack/container_tempest/tempest.conf /home/stack/tempest_workspace/etc/tempest.conf
$ cp /home/stack/container_tempest/tempest.conf /home/stack/tempest_workspace/etc/tempest.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Set the exit status for the command
Set executable privileges on the
tempest_script.shscript:chmod +x container_tempest/tempest_script.sh
$ chmod +x container_tempest/tempest_script.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the tempest script from the container using the alias that you created in a previous step:
podman-tempest -c 'set -e; /home/stack/container_tempest/tempest_script.sh'
$ podman-tempest -c 'set -e; /home/stack/container_tempest/tempest_script.sh'Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Inspect the
.stestrdirectory for information about the test results. If you want to rerun the tempest tests, you must first remove and recreate the tempest workspace:
sudo rm -rf /home/stack/tempest_workspace mkdir /home/stack/tempest_workspace
$ sudo rm -rf /home/stack/tempest_workspace $ mkdir /home/stack/tempest_workspaceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
6.3. Running Containerized Tempest outside the container Copier lienLien copié sur presse-papiers!
The container generates or retrieves the tempest.conf file and runs tests. You can perform these operations from outside the container:
Source the
overcloudrcfile if you want to run tempest against the overcloud. Source thestackrcfile if you want to run tempest against the undercloud:source /home/stack/container_tempest/overcloudrc
# source /home/stack/container_tempest/overcloudrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run
tempest initto create a tempest workspace. Use the shared directory so that the files are also accessible from the host:tempest init /home/stack/tempest_workspace
# tempest init /home/stack/tempest_workspaceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Generate the
tempest.conffile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about the options that you can include in the
discover-tempest-configcommand, rundiscover-tempest-config --help.Execute tempest tests. For example, run the following command to execute the tempest smoke test using the alias you created in a previous step:
podman-tempest -c "tempest run --smoke"
# podman-tempest -c "tempest run --smoke"Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Inspect the
.stestrdirectory for information about the test results. If you want to rerun the tempest tests, you must first remove and recreate the tempest workspace:
sudo rm -rf /home/stack/tempest_workspace mkdir /home/stack/tempest_workspace
$ sudo rm -rf /home/stack/tempest_workspace $ mkdir /home/stack/tempest_workspaceCopy to Clipboard Copied! Toggle word wrap Toggle overflow