#!/bin/bash set -eux ### --start_docs ## Validate the overcloud deployment with tempest ## ============================================== ## Configure tempest ## ----------------- ## * Clean up from any previous tempest run ## :: # On doing tempest init workspace, it will create workspace directory # as well as .workspace directory to store workspace information # We need to delete .workspace directory otherwise tempest init failed # to create tempest directory. # We are doing this as sudo because tempest in containers create the files as # root. # Cloud Credentials source /home/zuul/stackrc ## Create Tempest resources ## ------------------------ ## * For overcloud ## * Ensure creator and Member role is present ## * Member role is needed for Heat tests. ## * creator role is needed for Barbican for running volume encryption tests. ## :: openstack role show Member > /dev/null || openstack role create Member openstack role show creator > /dev/null || openstack role create creator ## Install openstack-tempest ## ------------------------- ## * Using git ## :: echo "========= Note: Executing tempest via a container ==========" cat <<'EOF' > /home/zuul/tempest_container.sh # Set the exit status for the command set -e # Load rc file or os_cloud file source /var/lib/tempest/stackrc # Get the list of tempest/-plugins rpms installed within a tempest container # It will be useful for debugging and making sure at what commit # tempest/tempest plugins rpms are installed in the same. rpm -qa | grep tempest # Remove the existing tempest workspace if [ -d /var/lib/tempest/tempest/etc ]; then tempest workspace remove --name tempest --rmdir fi ## Create Tempest Workspace ## ------------------------ ## :: # Create Tempest directory mkdir /var/lib/tempest/tempest # Create Tempest workspace pushd /var/lib/tempest/tempest tempest init /var/lib/tempest/tempest popd ## Generate tempest configuration using python-tempestconf ## ------------------------------------------------------- ## :: export TEMPESTCONF="/usr/bin/discover-tempest-config" region_name=${OS_REGION_NAME:-'regionOne'} # query the endpoint if not set (e.g. clouds.yaml) export OS_AUTH_URL=${OS_AUTH_URL:-$(openstack endpoint list --service=identity --interface=public -c URL -f value)} # set the itentity api version if not set (e.g. clouds.yaml) export OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION:-3} # OS_AUTH_URL does not contains identity api version in stackrc from # Pike onwards. export OS_AUTH_URL="$OS_AUTH_URL/v$OS_IDENTITY_API_VERSION" # Generate Tempest Config file using python-tempestconf # Notice aodh_plugin will be set to False if telemetry service is disabled cd /var/lib/tempest/tempest $TEMPESTCONF --out etc/tempest.conf \ --image /opt/cache/files/cirros-0.3.5-x86_64-disk.img \ --debug \ --create \ DEFAULT.log_dir /var/log/tempest \ DEFAULT.log_file tempest.log \ identity.region $region_name \ auth.use_dynamic_credentials true \ network-feature-enabled.port_security true \ network.tenant_network_cidr 192.168.0.0/24 \ compute.build_timeout 500 \ network.build_timeout 500 \ volume.build_timeout 500 \ orchestration.stack_owner_role Member \ compute_feature_enabled.config_drive True ### --stop_docs ## Run tempest ## ----------- ## :: export OSTESTR='ostestr' export TEMPESTCLI='/usr/bin/tempest' export TEMPESTDATA=/var/lib/tempest ## List tempest plugins ## :: $TEMPESTCLI list-plugins ## Save the resources before running tempest tests ## It will create saved_state.json in tempest workspace. ## :: $TEMPESTCLI run --whitelist_file=$TEMPESTDATA/whitelist_file.conf --blacklist_file=$TEMPESTDATA/skip_file --concurrency 4 ## Check which all tenants would be modified in the tempest run ## It will create dry_run.json in tempest workspace. ## :: EOF chmod +x /home/zuul/tempest_container.sh # Copy all the required files in a temprory directory export TEMPEST_HOST_DATA='/var/lib/tempestdata' if [ ! -d $TEMPEST_HOST_DATA ] then sudo mkdir -p $TEMPEST_HOST_DATA fi sudo cp \ /home/zuul/stackrc \ /home/zuul/skip_file \ /home/zuul/whitelist_file.conf \ /home/zuul/tempest_container.sh \ $TEMPEST_HOST_DATA export CONTAINER_BINARY='podman' sudo $CONTAINER_BINARY pull 192.168.24.1:8787/tripleostein/centos-binary-tempest:10b26ff7e3c7441c06bb15fa68ce5253bb2f4e62_ed97a127-updated-20200328050221 # Run tempest container using docker mouting required files sudo $CONTAINER_BINARY run --net=host -i -v $TEMPEST_HOST_DATA:/var/lib/tempest \ -e PYTHONWARNINGS="${PYTHONWARNINGS:-}" \ -e CURL_CA_BUNDLE="" \ --user=root \ -v /var/log/containers/tempest:/var/log/tempest \ -v /opt/cache/files/cirros-0.3.5-x86_64-disk.img:/opt/cache/files/cirros-0.3.5-x86_64-disk.img \ 192.168.24.1:8787/tripleostein/centos-binary-tempest:10b26ff7e3c7441c06bb15fa68ce5253bb2f4e62_ed97a127-updated-20200328050221 \ /usr/bin/bash -c 'set -e; /var/lib/tempest/tempest_container.sh' ### --stop_docs ### --stop_docs