blob: 9ca06acabf2ac3c944256ffe19a541cda4640f7e [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Sean Dagued0931212012-10-04 16:06:44 -04003# lib/tempest
Dean Troyer6d04fd72012-12-21 11:03:37 -06004# Install and configure Tempest
Sean Dagued0931212012-10-04 16:06:44 -04005
6# Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01007#
8# - ``functions`` file
9# - ``lib/nova`` service is running
10# - Global vars that are assumed to be defined:
11# - ``DEST``, ``FILES``
12# - ``ADMIN_PASSWORD``
13# - ``DEFAULT_IMAGE_NAME``
Matthew Treinishbefe0922017-02-16 15:45:11 -050014# - ``DEFAULT_IMAGE_FILE_NAME``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010015# - ``S3_SERVICE_PORT``
16# - ``SERVICE_HOST``
17# - ``BASE_SQL_CONN`` ``lib/database`` declares
18# - ``PUBLIC_NETWORK_NAME``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010019# - ``VIRT_DRIVER``
20# - ``LIBVIRT_TYPE``
Brant Knudsonc2c89e42017-02-23 20:15:47 -060021# - ``KEYSTONE_SERVICE_URI``, ``KEYSTONE_SERVICE_URI_V3`` from lib/keystone
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010022#
Attila Fazekas2aa35172012-12-05 20:03:40 +010023# Optional Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010024#
Einst Crazyf54f60a2015-10-30 23:00:57 +080025# - ``ALT_*``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010026# - ``LIVE_MIGRATION_AVAILABLE``
27# - ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION``
28# - ``DEFAULT_INSTANCE_TYPE``
29# - ``DEFAULT_INSTANCE_USER``
Weronika Sikorad7d87b02019-09-18 13:45:53 +000030# - ``DEFAULT_INSTANCE_ALT_USER``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +000031# - ``CINDER_ENABLED_BACKENDS``
Matt Riedemann89ee5852015-07-09 13:25:04 -070032# - ``NOVA_ALLOW_DUPLICATE_NETWORKS``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010033#
Sean Dagued0931212012-10-04 16:06:44 -040034# ``stack.sh`` calls the entry points in this order:
35#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010036# - install_tempest
37# - configure_tempest
Sean Dagued0931212012-10-04 16:06:44 -040038
39# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +110040_XTRACE_TEMPEST=$(set +o | grep xtrace)
Sean Dagued0931212012-10-04 16:06:44 -040041set +o xtrace
42
Dean Troyer6d04fd72012-12-21 11:03:37 -060043
Sean Dagued0931212012-10-04 16:06:44 -040044# Defaults
45# --------
46
Sean Dagued0931212012-10-04 16:06:44 -040047# Set up default directories
48TEMPEST_DIR=$DEST/tempest
john-griffithdc4dc7f2014-01-22 18:09:32 -070049TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
50TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf
Matthew Treinish14ccba02013-07-29 16:15:53 -040051TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest}
Attila Fazekas2aa35172012-12-05 20:03:40 +010052
Arx Cruz1bde9b42014-07-18 11:34:33 -030053# This is the timeout that tempest will wait for a VM to change state,
54# spawn, delete, etc.
55# The default is set to 196 seconds.
56BUILD_TIMEOUT=${BUILD_TIMEOUT:-196}
Sean Dagued0931212012-10-04 16:06:44 -040057
Joe Gordonc9b245b2015-02-10 14:32:39 -080058# This must be False on stable branches, as master tempest
59# deps do not match stable branch deps. Set this to True to
Dean Troyerdc97cb72015-03-28 08:20:50 -050060# have tempest installed in DevStack by default.
Matthew Treinishcb3cece2015-03-16 10:37:51 -040061INSTALL_TEMPEST=${INSTALL_TEMPEST:-"True"}
Joe Gordonc9b245b2015-02-10 14:32:39 -080062
Matthew Treinish440464c2016-05-04 11:55:12 -040063# This variable is passed directly to pip install inside the common tox venv
64# that is created
65TEMPEST_PLUGINS=${TEMPEST_PLUGINS:-0}
66
john-griffithdc4dc7f2014-01-22 18:09:32 -070067# Cinder/Volume variables
68TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
Eric Harney01456482014-10-14 18:53:53 -040069TEMPEST_DEFAULT_VOLUME_VENDOR="Open Source"
70TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-$TEMPEST_DEFAULT_VOLUME_VENDOR}
71TEMPEST_DEFAULT_STORAGE_PROTOCOL="iSCSI"
72TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
Dean Troyercc6b4432013-04-08 15:38:03 -050073
armando-migliaccio71ef61a2014-02-19 22:19:24 -080074# Neutron/Network variables
Sean Dague53753292014-12-04 19:38:15 -050075IPV6_ENABLED=$(trueorfalse True IPV6_ENABLED)
76IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True IPV6_SUBNET_ATTRIBUTES_ENABLED)
armando-migliaccio71ef61a2014-02-19 22:19:24 -080077
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040078# Do we want to make a configuration where Tempest has admin on
79# the cloud. We don't always want to so that we can ensure Tempest
80# would work on a public cloud.
81TEMPEST_HAS_ADMIN=$(trueorfalse True TEMPEST_HAS_ADMIN)
82
83# Credential provider configuration option variables
84TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-$TEMPEST_HAS_ADMIN}
Matthew Treinish403fbb12015-08-24 21:17:37 -040085TEMPEST_USE_TEST_ACCOUNTS=$(trueorfalse False TEMPEST_USE_TEST_ACCOUNTS)
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040086
87# The number of workers tempest is expected to be run with. This is used for
88# generating a accounts.yaml for running with test-accounts. This is also the
89# same variable that devstack-gate uses to specify the number of workers that
90# it will run tempest with
91TEMPEST_CONCURRENCY=${TEMPEST_CONCURRENCY:-$(nproc)}
92
Dean Troyercc6b4432013-04-08 15:38:03 -050093# Functions
94# ---------
Sean Dagued0931212012-10-04 16:06:44 -040095
Salvatore33e8ee22014-10-05 01:36:34 +020096# remove_disabled_extension - removes disabled extensions from the list of extensions
97# to test for a given service
98function remove_disabled_extensions {
99 local extensions_list=$1
100 shift
101 local disabled_exts=$*
fumihiko kakuma8606c982015-04-13 09:55:06 +0900102 remove_disabled_services "$extensions_list" "$disabled_exts"
Salvatore33e8ee22014-10-05 01:36:34 +0200103}
104
Matt Riedemann23d33a82018-11-21 12:10:32 -0500105# image_size_in_gib - converts an image size from bytes to GiB, rounded up
106# Takes an image ID parameter as input
107function image_size_in_gib {
108 local size
Julia Kreger5c9affd2021-03-12 11:19:52 -0800109 size=$(openstack --os-cloud devstack-admin image show $1 -c size -f value)
Lucas Alvares Gomes40f75792019-11-26 15:20:03 +0000110 echo $size | python3 -c "import math; print(int(math.ceil(float(int(input()) / 1024.0 ** 3))))"
Matt Riedemann23d33a82018-11-21 12:10:32 -0500111}
112
Ghanshyam Mann3bdc8f62021-02-09 12:56:34 -0600113function set_tempest_venv_constraints {
114 local tmp_c
115 tmp_c=$1
116 if [[ $TEMPEST_VENV_UPPER_CONSTRAINTS == "master" ]]; then
Dr. Jens Harbott2ef4a4c2022-01-03 15:13:44 +0100117 (cd $REQUIREMENTS_DIR &&
118 git show master:upper-constraints.txt 2>/dev/null ||
119 git show origin/master:upper-constraints.txt) > $tmp_c
Ghanshyam Mann3bdc8f62021-02-09 12:56:34 -0600120 else
121 echo "Using $TEMPEST_VENV_UPPER_CONSTRAINTS constraints in Tempest virtual env."
122 cat $TEMPEST_VENV_UPPER_CONSTRAINTS > $tmp_c
123 # NOTE: setting both tox env var and once Tempest start using new var
124 # TOX_CONSTRAINTS_FILE then we can remove the old one.
125 export UPPER_CONSTRAINTS_FILE=$TEMPEST_VENV_UPPER_CONSTRAINTS
126 export TOX_CONSTRAINTS_FILE=$TEMPEST_VENV_UPPER_CONSTRAINTS
127 fi
128}
129
Sean Dagued0931212012-10-04 16:06:44 -0400130# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +1100131function configure_tempest {
Joe Gordonc9b245b2015-02-10 14:32:39 -0800132 if [[ "$INSTALL_TEMPEST" == "True" ]]; then
133 setup_develop $TEMPEST_DIR
134 else
135 # install testr since its used to process tempest logs
Sean Dague60996b12015-04-08 09:06:49 -0400136 pip_install_gr testrepository
Joe Gordonc9b245b2015-02-10 14:32:39 -0800137 fi
Joe Gordond5ac7852015-02-06 19:29:23 -0800138
Attila Fazekas65c08462012-12-07 14:20:51 +0100139 local image_lines
140 local images
141 local num_images
142 local image_uuid
143 local image_uuid_alt
Attila Fazekas65c08462012-12-07 14:20:51 +0100144 local password
145 local line
146 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -0800147 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +0100148 local flavors_ref
149 local flavor_lines
Szymon Datko28c49812019-08-22 15:39:53 +0200150 local flavor_ref_size
151 local flavor_ref_alt_size
Maru Newbya5c774e2012-12-10 10:40:01 +0000152 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +0000153 local public_router_id
Sean Dague5544c4a2016-01-25 08:27:06 -0500154 local ssh_connect_method="floating"
Matt Riedemann23d33a82018-11-21 12:10:32 -0500155 local disk
Attila Fazekas2aa35172012-12-05 20:03:40 +0100156
Dean Troyer6d04fd72012-12-21 11:03:37 -0600157 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100158 ifs=$IFS
159
160 # Glance should already contain images to be used in tempest
161 # testing. Here we simply look for images stored in Glance
162 # and set the appropriate variables for use in the tempest config
163 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100164 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
165 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100166 # if there is more than one returned...
167 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500168 declare -a images
169
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200170 if is_service_enabled glance; then
171 while read -r IMAGE_NAME IMAGE_UUID; do
172 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
173 image_uuid="$IMAGE_UUID"
174 image_uuid_alt="$IMAGE_UUID"
175 fi
176 images+=($IMAGE_UUID)
Julia Kreger5c9affd2021-03-12 11:19:52 -0800177 done < <(openstack --os-cloud devstack-admin image list --property status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500178
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200179 case "${#images[*]}" in
180 0)
181 echo "Found no valid images to use!"
182 exit 1
183 ;;
184 1)
185 if [ -z "$image_uuid" ]; then
186 image_uuid=${images[0]}
187 image_uuid_alt=${images[0]}
188 fi
189 ;;
190 *)
191 if [ -z "$image_uuid" ]; then
192 image_uuid=${images[0]}
193 image_uuid_alt=${images[1]}
194 fi
195 ;;
196 esac
197 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100198
Matthew Treinish93c10572015-07-31 10:38:50 -0400199 # (Re)create ``tempest.conf``
200 # Create every time because the image UUIDS are going to change
Dean Troyer8421c2b2015-03-16 13:52:19 -0500201 sudo install -d -o $STACK_USER $TEMPEST_CONFIG_DIR
Matthew Treinish93c10572015-07-31 10:38:50 -0400202 rm -f $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100203
Balagopal7ed812c2016-03-01 04:43:31 +0000204 local password=${ADMIN_PASSWORD:-secret}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100205
Dean Troyerdc97cb72015-03-28 08:20:50 -0500206 # See ``lib/keystone`` where these users and tenants are set up
Sean Dague0f765352016-02-18 06:53:08 -0500207 local admin_username=${ADMIN_USERNAME:-admin}
Sean Dague76392b52016-04-04 09:07:08 -0400208 local admin_project_name=${ADMIN_TENANT_NAME:-admin}
Sean Dague0f765352016-02-18 06:53:08 -0500209 local admin_domain_name=${ADMIN_DOMAIN_NAME:-Default}
Sean Dague0f765352016-02-18 06:53:08 -0500210 local alt_username=${ALT_USERNAME:-alt_demo}
Sean Dague76392b52016-04-04 09:07:08 -0400211 local alt_project_name=${ALT_TENANT_NAME:-alt_demo}
212 local admin_project_id
Julia Kreger5c9affd2021-03-12 11:19:52 -0800213 admin_project_id=$(openstack --os-cloud devstack-admin project list | awk "/ admin / { print \$2 }")
Attila Fazekas2aa35172012-12-05 20:03:40 +0100214
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200215 if is_service_enabled nova; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500216 # If ``DEFAULT_INSTANCE_TYPE`` is not declared, use the new behavior
217 # Tempest creates its own instance types
Julia Kreger5c9affd2021-03-12 11:19:52 -0800218 available_flavors=$(openstack --os-cloud devstack-admin flavor list)
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200219 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200220 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
Matt Riedemann23d33a82018-11-21 12:10:32 -0500221 # Determine the flavor disk size based on the image size.
222 disk=$(image_size_in_gib $image_uuid)
Julia Kreger5c9affd2021-03-12 11:19:52 -0800223 openstack --os-cloud devstack-admin flavor create --id 42 --ram 128 --disk $disk --vcpus 1 --property hw_rng:allowed=True m1.nano
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200224 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200225 flavor_ref=42
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200226 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
Matt Riedemann23d33a82018-11-21 12:10:32 -0500227 # Determine the alt flavor disk size based on the alt image size.
228 disk=$(image_size_in_gib $image_uuid_alt)
Julia Kreger5c9affd2021-03-12 11:19:52 -0800229 openstack --os-cloud devstack-admin flavor create --id 84 --ram 192 --disk $disk --vcpus 1 --property hw_rng:allowed=True m1.micro
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200230 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200231 flavor_ref_alt=84
232 else
Dean Troyerdc97cb72015-03-28 08:20:50 -0500233 # Check Nova for existing flavors, if ``DEFAULT_INSTANCE_TYPE`` is set use it.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200234 IFS=$'\r\n'
235 flavors=""
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600236 for line in $available_flavors; do
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200237 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
238 flavors="$flavors $f"
239 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100240
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600241 for line in $available_flavors; do
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200242 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
243 done
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100244
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200245 IFS=" "
246 flavors=($flavors)
247 num_flavors=${#flavors[*]}
248 echo "Found $num_flavors flavors"
249 if [[ $num_flavors -eq 0 ]]; then
250 echo "Found no valid flavors to use!"
251 exit 1
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400252 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200253 flavor_ref=${flavors[0]}
254 flavor_ref_alt=$flavor_ref
Julia Kreger5c9affd2021-03-12 11:19:52 -0800255 flavor_ref_size=$(openstack --os-cloud devstack-admin flavor show --format value --column disk "${flavor_ref}")
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200256
Dean Troyerdc97cb72015-03-28 08:20:50 -0500257 # Ensure ``flavor_ref`` and ``flavor_ref_alt`` have different values.
258 # Some resize instance in tempest tests depends on this.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200259 for f in ${flavors[@]:1}; do
John L. Villalovos3345a6d2017-03-13 13:47:34 -0700260 if [[ "$f" != "$flavor_ref" ]]; then
Szymon Datko28c49812019-08-22 15:39:53 +0200261 #
262 # NOTE(sdatko): Resize is only possible when target flavor
263 # is not smaller than the original one. For
264 # Tempest tests, in case there was a bigger
265 # flavor selected as default, e.g. m1.small,
266 # we need to perform additional check.
267 #
Julia Kreger5c9affd2021-03-12 11:19:52 -0800268 flavor_ref_alt_size=$(openstack --os-cloud devstack-admin flavor show --format value --column disk "${f}")
Szymon Datko28c49812019-08-22 15:39:53 +0200269 if [[ "${flavor_ref_alt_size}" -lt "${flavor_ref_size}" ]]; then
270 continue
271 fi
272
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200273 flavor_ref_alt=$f
274 break
275 fi
276 done
277 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100278 fi
279
Dan Smitha2ec7fd2016-08-10 11:14:00 -0700280 iniset $TEMPEST_CONFIG network project_network_cidr $FIXED_RANGE
281
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200282 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
283
Armando Migliaccio53f59d82016-05-17 15:12:24 -0700284 # the public network (for floating ip access) is only available
285 # if the extension is enabled.
Eric Berglund8e142402016-11-29 17:33:28 -0600286 # If NEUTRON_CREATE_INITIAL_NETWORKS is not true, there is no network created
287 # and the public_network_id should not be set.
288 if [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "True" ]] && is_networking_extension_supported 'external-net'; then
Julia Kreger5c9affd2021-03-12 11:19:52 -0800289 public_network_id=$(openstack --os-cloud devstack-admin network show -f value -c id $PUBLIC_NETWORK_NAME)
Attila Fazekas0d4c9c92018-09-10 15:52:46 -0600290 # make sure shared network presence does not confuses the tempest tests
Slawek Kaplonski14a0c092022-01-28 09:44:40 +0100291 openstack --os-cloud devstack-admin --os-region "$REGION_NAME" network create --share shared
292 openstack --os-cloud devstack-admin --os-region "$REGION_NAME" subnet create --description shared-subnet --subnet-range ${TEMPEST_SHARED_POOL:-192.168.233.0/24} --network shared shared-subnet
Maru Newbya5c774e2012-12-10 10:40:01 +0000293 fi
294
Masayuki Igawa5a252d92014-11-21 21:55:09 +0900295 iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG
Dean Troyerdc97cb72015-03-28 08:20:50 -0500296
Matthew Treinish859cc682013-07-26 15:22:44 -0400297 # Oslo
Joe Gordon23d6d502015-03-06 15:24:22 -0800298 iniset $TEMPEST_CONFIG oslo_concurrency lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400299 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700300 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
301 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
302 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400303
Attila Fazekas2aa35172012-12-05 20:03:40 +0100304 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700305 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
306 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
Attila Fazekas2aa35172012-12-05 20:03:40 +0100307
Attila Fazekas97d3d202013-01-19 19:20:49 +0100308 # Identity
Brant Knudsonc2c89e42017-02-23 20:15:47 -0600309 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_URI/v2.0/"
Steve Martinellib74e01c2014-12-18 01:35:35 -0500310 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_URI_V3"
Rodrigo Duarteb51a8862016-09-26 15:22:35 -0300311 iniset $TEMPEST_CONFIG identity user_lockout_failure_attempts $KEYSTONE_LOCKOUT_FAILURE_ATTEMPTS
312 iniset $TEMPEST_CONFIG identity user_lockout_duration $KEYSTONE_LOCKOUT_DURATION
313 iniset $TEMPEST_CONFIG identity user_unique_last_password_count $KEYSTONE_UNIQUE_LAST_PASSWORD_COUNT
Matthew Treinish7ced1502015-03-23 15:51:54 -0400314 if [[ "$TEMPEST_HAS_ADMIN" == "True" ]]; then
Sean Dague0f765352016-02-18 06:53:08 -0500315 iniset $TEMPEST_CONFIG auth admin_username $admin_username
Matthew Treinishfbe0a622015-12-10 19:36:50 -0500316 iniset $TEMPEST_CONFIG auth admin_password "$password"
Castulo J. Martinez2d9959c2016-11-01 13:34:20 -0700317 iniset $TEMPEST_CONFIG auth admin_project_name $admin_project_name
Sean Dague0f765352016-02-18 06:53:08 -0500318 iniset $TEMPEST_CONFIG auth admin_domain_name $admin_domain_name
Matthew Treinish7ced1502015-03-23 15:51:54 -0400319 fi
Paulo Ewerton75bf9722016-01-22 19:13:31 +0000320 if [ "$ENABLE_IDENTITY_V2" == "True" ]; then
321 # Run Identity API v2 tests ONLY if needed
322 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 True
Paulo Ewerton75bf9722016-01-22 19:13:31 +0000323 else
324 # Skip Identity API v2 tests by default
325 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 False
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300326 fi
Ken'ichi Ohmichidc6e5502017-03-03 16:55:50 -0800327 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v3}
ghanshyam11b86492018-08-07 08:37:24 +0000328 if [[ "$TEMPEST_AUTH_VERSION" != "v2" ]]; then
329 # we're going to disable v2 admin unless we're using v2 by default.
Sean Daguebb443112017-04-19 16:22:42 -0400330 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2_admin False
331 fi
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300332
Sean Daguef3b2f4c2017-04-13 10:11:48 -0400333 if is_service_enabled tls-proxy; then
Rob Crittendene1d013f2015-02-10 14:15:35 -0500334 iniset $TEMPEST_CONFIG identity ca_certificates_file $SSL_BUNDLE_FILE
335 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100336
Rodrigo Duarte0578e422016-03-16 12:15:07 -0300337 # Identity Features
Rodrigo Duarteb51a8862016-09-26 15:22:35 -0300338 if [[ "$KEYSTONE_SECURITY_COMPLIANCE_ENABLED" = True ]]; then
339 iniset $TEMPEST_CONFIG identity-feature-enabled security_compliance True
340 fi
Rodrigo Duarte0578e422016-03-16 12:15:07 -0300341
Leticia Wanderley1d141da2017-08-04 00:42:59 -0300342 # When LDAP is enabled domain specific drivers are also enabled and the users
343 # and groups identity tests must adapt to this scenario
344 if is_service_enabled ldap; then
345 iniset $TEMPEST_CONFIG identity-feature-enabled domain_specific_drivers True
346 fi
347
Felipe Monteiro1ab9a2d2018-03-16 02:02:12 +0000348 # TODO(felipemonteiro): Remove this once Tempest no longer supports Pike
349 # as this is supported in Queens and beyond.
350 iniset $TEMPEST_CONFIG identity-feature-enabled project_tags True
351
Colleen Murphy931f82d2018-02-18 14:11:10 +0100352 # In Queens and later, application credentials are enabled by default
353 # so remove this once Tempest no longer supports Pike.
354 iniset $TEMPEST_CONFIG identity-feature-enabled application_credentials True
355
Colleen Murphyf8aa74b2019-12-27 09:30:57 -0800356 # In Train and later, access rules for application credentials are enabled
357 # by default so remove this once Tempest no longer supports Stein.
358 iniset $TEMPEST_CONFIG identity-feature-enabled access_rules True
359
Sean Daguec3771452013-06-13 14:23:37 -0400360 # Image
Dean Troyerdc97cb72015-03-28 08:20:50 -0500361 # We want to be able to override this variable in the gate to avoid
362 # doing an external HTTP fetch for this test.
Sean Daguec3771452013-06-13 14:23:37 -0400363 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700364 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400365 fi
Ghanshyam Mann32d5b1e2020-07-22 20:52:48 -0500366 iniset $TEMPEST_CONFIG image-feature-enabled import_image $GLANCE_USE_IMPORT_WORKFLOW
Dan Smithed164282021-01-18 09:57:00 -0800367 iniset $TEMPEST_CONFIG image-feature-enabled os_glance_reserved True
Dan Smith802259a2021-01-12 22:55:57 +0000368 if is_service_enabled g-api-r; then
Dan Smith61b4fbf2021-03-09 08:05:37 -0800369 iniset $TEMPEST_CONFIG image alternate_image_endpoint image_remote
Dan Smith802259a2021-01-12 22:55:57 +0000370 fi
371
Attila Fazekas97d3d202013-01-19 19:20:49 +0100372 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700373 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
john-griffithdc4dc7f2014-01-22 18:09:32 -0700374 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700375 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
376 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
Sean Dague563a7e72015-12-15 17:16:19 -0500377 iniset $TEMPEST_CONFIG validation connect_method $ssh_connect_method
Stephen Finucane4b8cba72019-05-21 14:17:11 +0100378 if ! is_service_enabled neutron; then
melanie wittf5b550e2015-04-10 22:20:07 +0000379 iniset $TEMPEST_CONFIG compute fixed_network_name $PRIVATE_NETWORK_NAME
380 fi
Attila Fazekas97d3d202013-01-19 19:20:49 +0100381
Sean Dague8349aff2015-09-01 12:45:28 -0400382 # Set the service catalog entry for Tempest to run on. Typically
383 # used to try different compute API version targets. The tempest
384 # default if 'compute', which is typically valid, so only set this
385 # if you want to change it.
386 if [[ -n "$TEMPEST_COMPUTE_TYPE" ]]; then
387 iniset $TEMPEST_CONFIG compute catalog_type $TEMPEST_COMPUTE_TYPE
388 fi
389
Sean Daguede19bf92014-03-20 16:54:58 -0400390 # Compute Features
ghanshyam642b07b2015-11-19 10:01:14 +0900391 # Set the microversion range for compute tests.
392 # This is used to run the Nova microversions tests.
393 # Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
394 # NOTE- To avoid microversion tests failure on stable branch, we need to change "tempest_compute_max_microversion"
395 # for stable branch on each release which should be changed from "latest" to max supported version of that release.
396 local tempest_compute_min_microversion=${TEMPEST_COMPUTE_MIN_MICROVERSION:-None}
397 local tempest_compute_max_microversion=${TEMPEST_COMPUTE_MAX_MICROVERSION:-"latest"}
398 # Reset microversions to None where v2.0 is running which does not support microversion.
399 # Both "None" means no microversion testing.
400 if [[ "$TEMPEST_COMPUTE_TYPE" == "compute_legacy" ]]; then
401 tempest_compute_min_microversion=None
402 tempest_compute_max_microversion=None
403 fi
404 if [ "$tempest_compute_min_microversion" == "None" ]; then
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200405 inicomment $TEMPEST_CONFIG compute min_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900406 else
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200407 iniset $TEMPEST_CONFIG compute min_microversion $tempest_compute_min_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900408 fi
409 if [ "$tempest_compute_max_microversion" == "None" ]; then
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200410 inicomment $TEMPEST_CONFIG compute max_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900411 else
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200412 iniset $TEMPEST_CONFIG compute max_microversion $tempest_compute_max_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900413 fi
414
Matt Riedemann6d3670a2016-07-03 19:40:25 -0400415 iniset $TEMPEST_CONFIG compute-feature-enabled personality ${ENABLE_FILE_INJECTION:-False}
Sean Daguede19bf92014-03-20 16:54:58 -0400416 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000417 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
418 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
419 iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
Pawel Koniszewski8a92b7f2016-10-05 16:14:19 +0200420 iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_back_and_forth ${LIVE_MIGRATE_BACK_AND_FORTH:-False}
Matt Riedemanne57a3322015-06-20 14:48:00 -0700421 iniset $TEMPEST_CONFIG compute-feature-enabled attach_encrypted_volume ${ATTACH_ENCRYPTED_VOLUME_AVAILABLE:-True}
Artom Lifshitz47058612018-05-23 10:08:56 -0400422
Pavan Kesava Rao71bd10e2021-07-19 13:33:42 -0400423 # Starting Wallaby, nova sanitizes instance hostnames having freeform characters with dashes
424 iniset $TEMPEST_CONFIG compute-feature-enabled hostname_fqdn_sanitization True
425
Artom Lifshitz47058612018-05-23 10:08:56 -0400426 if [[ -n "$NOVA_FILTERS" ]]; then
427 iniset $TEMPEST_CONFIG compute-feature-enabled scheduler_enabled_filters ${NOVA_FILTERS}
428 fi
429
Matt Riedemannffe691e2016-01-12 17:58:44 -0800430 if [[ $ENABLE_VOLUME_MULTIATTACH == "True" ]]; then
431 iniset $TEMPEST_CONFIG compute-feature-enabled volume_multiattach True
432 fi
433
melanie witt6645cf72017-12-13 23:59:09 +0000434 if is_service_enabled n-novnc; then
Michelle Mandel10db2b82016-07-20 11:39:42 -0400435 iniset $TEMPEST_CONFIG compute-feature-enabled vnc_console True
436 fi
437
Marian Horbanea21eb42015-08-18 06:57:18 -0400438 # Network
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200439 iniset $TEMPEST_CONFIG network project_networks_reachable false
john-griffithdc4dc7f2014-01-22 18:09:32 -0700440 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
441 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
442 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500443 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400444 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Matt Riedemannc9c9d312016-09-15 20:33:22 -0400445 iniset $TEMPEST_CONFIG network-feature-enabled port_security $NEUTRON_PORT_SECURITY
Salvatore33e8ee22014-10-05 01:36:34 +0200446
Slawek Kaplonski24b65ad2021-06-22 15:31:46 +0200447 iniset $TEMPEST_CONFIG enforce_scope neutron "$NEUTRON_ENFORCE_SCOPE"
448
William Marshall24d866e2013-07-02 12:26:31 -0500449 # Scenario
Stephen Finucane970891a2021-03-02 16:45:39 +0000450 SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES}
451 SCENARIO_IMAGE_FILE=$DEFAULT_IMAGE_FILE_NAME
Martin Kopec729546a2020-03-12 10:03:38 +0000452 iniset $TEMPEST_CONFIG scenario img_file $SCENARIO_IMAGE_DIR/$SCENARIO_IMAGE_FILE
William Marshall24d866e2013-07-02 12:26:31 -0500453
Michael Turek7938d832016-04-12 14:55:21 -0400454 # If using provider networking, use the physical network for validation rather than private
455 TEMPEST_SSH_NETWORK_NAME=$PRIVATE_NETWORK_NAME
456 if is_provider_network; then
457 TEMPEST_SSH_NETWORK_NAME=$PHYSICAL_NETWORK
458 fi
lanoux994db612015-08-03 13:48:12 +0000459 # Validation
Andrea Frittolief1e88e2017-04-20 23:37:32 +0100460 iniset $TEMPEST_CONFIG validation run_validation ${TEMPEST_RUN_VALIDATION:-True}
Matthew Treinishfbe0a622015-12-10 19:36:50 -0500461 iniset $TEMPEST_CONFIG validation ip_version_for_ssh 4
462 iniset $TEMPEST_CONFIG validation ssh_timeout $BUILD_TIMEOUT
Weronika Sikorad7d87b02019-09-18 13:45:53 +0000463 iniset $TEMPEST_CONFIG validation image_ssh_user ${DEFAULT_INSTANCE_USER:=cirros}
464 iniset $TEMPEST_CONFIG validation image_alt_ssh_user ${DEFAULT_INSTANCE_ALT_USER:-$DEFAULT_INSTANCE_USER}
Michael Turek7938d832016-04-12 14:55:21 -0400465 iniset $TEMPEST_CONFIG validation network_for_ssh $TEMPEST_SSH_NETWORK_NAME
lanoux994db612015-08-03 13:48:12 +0000466
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200467 # Volume
Patrick East3eb7c972017-01-13 11:44:54 -0800468 # Only turn on TEMPEST_VOLUME_MANAGE_SNAPSHOT by default for "lvm" backends
469 if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]]; then
470 TEMPEST_VOLUME_MANAGE_SNAPSHOT=${TEMPEST_VOLUME_MANAGE_SNAPSHOT:-True}
471 fi
472 iniset $TEMPEST_CONFIG volume-feature-enabled manage_snapshot $(trueorfalse False TEMPEST_VOLUME_MANAGE_SNAPSHOT)
jeremy.zhangd5919d02017-03-08 15:27:37 +0800473 # Only turn on TEMPEST_VOLUME_MANAGE_VOLUME by default for "lvm" backends
474 if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]]; then
475 TEMPEST_VOLUME_MANAGE_VOLUME=${TEMPEST_VOLUME_MANAGE_VOLUME:-True}
476 fi
477 iniset $TEMPEST_CONFIG volume-feature-enabled manage_volume $(trueorfalse False TEMPEST_VOLUME_MANAGE_VOLUME)
Matt Riedemann17cdecc2017-07-05 20:25:02 -0400478 # Only turn on TEMPEST_EXTEND_ATTACHED_VOLUME by default for "lvm" backends
479 # in Cinder and the libvirt driver in Nova.
480 if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]] && [ "$VIRT_DRIVER" = "libvirt" ]; then
481 TEMPEST_EXTEND_ATTACHED_VOLUME=${TEMPEST_EXTEND_ATTACHED_VOLUME:-True}
482 fi
483 iniset $TEMPEST_CONFIG volume-feature-enabled extend_attached_volume $(trueorfalse False TEMPEST_EXTEND_ATTACHED_VOLUME)
Luigi Toscano8fd45de2020-05-12 12:00:20 +0200484 # Only turn on TEMPEST_VOLUME_REVERT_TO_SNAPSHOT by default for "lvm" backends
485 if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]]; then
486 TEMPEST_VOLUME_REVERT_TO_SNAPSHOT=${TEMPEST_VOLUME_REVERT_TO_SNAPSHOT:-True}
487 fi
488 iniset $TEMPEST_CONFIG volume-feature-enabled volume_revert $(trueorfalse False TEMPEST_VOLUME_REVERT_TO_SNAPSHOT)
Alex Meade0c0c09a2016-05-13 10:57:29 -0400489 local tempest_volume_min_microversion=${TEMPEST_VOLUME_MIN_MICROVERSION:-None}
490 local tempest_volume_max_microversion=${TEMPEST_VOLUME_MAX_MICROVERSION:-"latest"}
491 if [ "$tempest_volume_min_microversion" == "None" ]; then
492 inicomment $TEMPEST_CONFIG volume min_microversion
493 else
494 iniset $TEMPEST_CONFIG volume min_microversion $tempest_volume_min_microversion
495 fi
496
497 if [ "$tempest_volume_max_microversion" == "None" ]; then
498 inicomment $TEMPEST_CONFIG volume max_microversion
499 else
500 iniset $TEMPEST_CONFIG volume max_microversion $tempest_volume_max_microversion
501 fi
David Kranzd1d66672015-06-11 13:09:37 -0400502
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100503 if ! is_service_enabled c-bak; then
504 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200505 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000506
Dean Troyerdc97cb72015-03-28 08:20:50 -0500507 # Using ``CINDER_ENABLED_BACKENDS``
bkopilov3ac1ea82016-06-06 16:00:48 +0300508 # Cinder uses a comma separated list with "type:backend_name":
509 # CINDER_ENABLED_BACKENDS = ceph:cephBE1,lvm:lvmBE2,foo:my_foo
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000510 if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
bkopilov3ac1ea82016-06-06 16:00:48 +0300511 # We have at least 2 backends
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000512 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
bkopilov3ac1ea82016-06-06 16:00:48 +0300513 local add_comma_seperator=0
514 local backends_list=''
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000515 local be
bkopilov3ac1ea82016-06-06 16:00:48 +0300516 # Tempest uses a comma separated list of backend_names:
517 # backend_names = BACKEND_1,BACKEND_2
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000518 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
bkopilov3ac1ea82016-06-06 16:00:48 +0300519 if [ "$add_comma_seperator" -eq "1" ]; then
520 backends_list+=,${be##*:}
521 else
522 # first element in the list
523 backends_list+=${be##*:}
524 add_comma_seperator=1
525 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000526 done
bkopilov3ac1ea82016-06-06 16:00:48 +0300527 iniset $TEMPEST_CONFIG volume "backend_names" "$backends_list"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700528 fi
529
Eric Harney01456482014-10-14 18:53:53 -0400530 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
Patrick East1c0628f2014-10-22 16:22:47 -0700531 "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
Ed Balduf2f23d752014-07-29 14:42:27 -0600532 iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
Eric Harney01456482014-10-14 18:53:53 -0400533 fi
534 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
JordanP82a7d932014-12-04 14:09:16 +0100535 "$TEMPEST_STORAGE_PROTOCOL" != "$TEMPEST_DEFAULT_STORAGE_PROTOCOL" ]; then
536 iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200537 fi
538
Ghanshyam Mannfc207052019-06-05 08:24:45 +0000539 # Placement Features
540 # Set the microversion range for placement.
541 # Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
542 # NOTE- To avoid microversion tests failure on stable branch, we need to change "tempest_placement_max_microversion"
543 # for stable branch on each release which should be changed from "latest" to max supported version of that release.
544 local tempest_placement_min_microversion=${TEMPEST_PLACEMENT_MIN_MICROVERSION:-None}
545 local tempest_placement_max_microversion=${TEMPEST_PLACEMENT_MAX_MICROVERSION:-"latest"}
546 if [ "$tempest_placement_min_microversion" == "None" ]; then
547 inicomment $TEMPEST_CONFIG placement min_microversion
548 else
549 iniset $TEMPEST_CONFIG placement min_microversion $tempest_placement_min_microversion
550 fi
551 if [ "$tempest_placement_max_microversion" == "None" ]; then
552 inicomment $TEMPEST_CONFIG placement max_microversion
553 else
554 iniset $TEMPEST_CONFIG placement max_microversion $tempest_placement_max_microversion
555 fi
556
Adam Gandelman43bd6672014-04-03 11:13:13 -0700557 # Baremetal
558 if [ "$VIRT_DRIVER" = "ironic" ] ; then
Adam Gandelmanfdfe7a02014-07-24 10:06:18 -0400559 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
560 iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
561 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
562 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
563 iniset $TEMPEST_CONFIG compute-feature-enabled pause False
564 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
565 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
566 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
567 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
David Shrewsburycf21b712014-08-13 07:03:58 -0400568 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Adam Gandelman43bd6672014-04-03 11:13:13 -0700569 fi
570
Matt Riedemann92575ba2016-09-21 16:15:31 -0400571 # Libvirt
572 if [ "$VIRT_DRIVER" = "libvirt" ]; then
573 # Libvirt-LXC
574 if [ "$LIBVIRT_TYPE" = "lxc" ]; then
575 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
576 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
577 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
578 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
579 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Stephen Finucane4b8cba72019-05-21 14:17:11 +0100580 else
Alexandre Arents4a1186a2020-09-17 12:50:53 +0000581 iniset $TEMPEST_CONFIG compute-feature-enabled shelve_migrate True
Lee Yarwood4361ef12019-12-11 17:53:44 +0000582 iniset $TEMPEST_CONFIG compute-feature-enabled stable_rescue True
Matt Riedemanne9a9fbe2017-01-30 22:22:43 -0500583 iniset $TEMPEST_CONFIG compute-feature-enabled swap_volume True
Matt Riedemann92575ba2016-09-21 16:15:31 -0400584 fi
Nels Nelson7b47c472015-01-05 16:36:42 -0600585 fi
586
Dean Troyerdc97cb72015-03-28 08:20:50 -0500587 # ``service_available``
Sean Dague346edcc2015-08-26 09:38:37 -0400588 #
ghanshyamf0dd9992018-11-26 07:38:54 +0000589 # this tempest service list needs to be the services that
590 # tempest own, otherwise we can have an erroneous set of
Sean Dague346edcc2015-08-26 09:38:37 -0400591 # defaults (something defaulting true in Tempest, but not listed here).
ghanshyamf0dd9992018-11-26 07:38:54 +0000592 # services tested by tempest plugins needs to be set on service devstack
593 # plugin side as devstack cannot keep track of all the tempest plugins
594 # services. Refer Bug#1743688 for more details.
595 # 'horizon' is also kept here as no devtack plugin for horizon.
Sean Dague0f765352016-02-18 06:53:08 -0500596 local service
ghanshyamf0dd9992018-11-26 07:38:54 +0000597 local tempest_services="key,glance,nova,neutron,cinder,swift,horizon"
Sean Dague0f765352016-02-18 06:53:08 -0500598 for service in ${tempest_services//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400599 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700600 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400601 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700602 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400603 fi
604 done
605
Ghanshyam Mann8c930492021-03-05 09:40:39 -0600606 iniset $TEMPEST_CONFIG enforce_scope glance "$GLANCE_ENFORCE_SCOPE"
Ghanshyam Mann9dc2b882021-03-05 09:32:19 -0600607
Ghanshyam Mannbd0d0fd2021-03-06 17:23:39 -0600608 iniset $TEMPEST_CONFIG enforce_scope cinder "$CINDER_ENFORCE_SCOPE"
609
Matt Riedemanncf94edc2015-10-28 09:50:01 -0700610 if [ "$VIRT_DRIVER" = "libvirt" ] && [ "$LIBVIRT_TYPE" = "lxc" ]; then
611 # libvirt-lxc does not support boot from volume or attaching volumes
612 # so basically anything with cinder is out of the question.
613 iniset $TEMPEST_CONFIG service_available cinder "False"
614 fi
615
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400616 # Run tempest configuration utilities. This must be done last during configuration to
617 # ensure as complete a config as possible already exists
618
619 # NOTE(mtreinish): Respect constraints on tempest verify-config venv
620 local tmp_cfg_file
621 tmp_cfg_file=$(mktemp)
622 cd $TEMPEST_DIR
623 if [[ "$OFFLINE" != "True" ]]; then
Matthew Treinish440464c2016-05-04 11:55:12 -0400624 tox -revenv-tempest --notest
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400625 fi
Claudiu Belu34c16792017-06-12 09:32:21 -0700626
Rodolfo Alonso Hernandez8579f582019-11-04 11:37:54 +0000627 local tmp_u_c_m
628 tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
Ghanshyam Mann3bdc8f62021-02-09 12:56:34 -0600629 set_tempest_venv_constraints $tmp_u_c_m
Rodolfo Alonso Hernandez8579f582019-11-04 11:37:54 +0000630 tox -evenv-tempest -- pip install -c $tmp_u_c_m -r requirements.txt
631 rm -f $tmp_u_c_m
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400632
633 # Auth:
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400634 if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
635 if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
Soniya Vyas7634c782019-12-26 16:59:56 +0530636 tox -evenv-tempest -- tempest account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-project-name $admin_project_name -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400637 else
Soniya Vyas7634c782019-12-26 16:59:56 +0530638 tox -evenv-tempest -- tempest account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-project-name $admin_project_name -r $TEMPEST_CONCURRENCY etc/accounts.yaml
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400639 fi
640 iniset $TEMPEST_CONFIG auth use_dynamic_credentials False
641 iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
642 elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
643 iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
644
645 else
646 iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
647 fi
648
649 # API Extensions
650 # Run ``verify_tempest_config -ur`` to retrieve enabled extensions on API endpoints
651 # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
652 tox -evenv -- tempest verify-config -uro $tmp_cfg_file
Sean Dague7b229352016-08-09 13:29:11 -0400653
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400654 # Neutron API Extensions
Sean Dague894ccc92016-08-08 16:19:05 -0400655
656 # disable metering if we didn't enable the service
657 if ! is_service_enabled q-metering; then
658 DISABLE_NETWORK_API_EXTENSIONS+=", metering"
659 fi
660
Dima Kuznetsov787412c2017-08-28 09:09:38 +0300661 # disable l3_agent_scheduler if we didn't enable L3 agent
662 if ! is_service_enabled q-l3; then
663 DISABLE_NETWORK_API_EXTENSIONS+=", l3_agent_scheduler"
664 fi
665
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400666 local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
667 if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
668 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
669 network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
670 # Remove disabled extensions
671 network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
672 fi
Ghanshyam Mann52c28862019-06-20 07:42:31 +0000673 if [[ -n "$ADDITIONAL_NETWORK_API_EXTENSIONS" ]] && [[ "$network_api_extensions" != "all" ]]; then
674 network_api_extensions+=",$ADDITIONAL_NETWORK_API_EXTENSIONS"
675 fi
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400676 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
677 # Swift API Extensions
678 local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
679 if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
680 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
681 object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
682 # Remove disabled extensions
683 object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
684 fi
685 iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
686 # Cinder API Extensions
687 local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
688 if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
689 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
690 volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
691 # Remove disabled extensions
692 volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
693 fi
694 iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
695
Attila Fazekas2aa35172012-12-05 20:03:40 +0100696 # Restore IFS
697 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400698}
699
Sean Dagued0931212012-10-04 16:06:44 -0400700# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100701function install_tempest {
Sean Dagued0931212012-10-04 16:06:44 -0400702 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Anna Khmelnitsky730faa22017-09-01 16:25:09 -0700703 pip_install 'tox!=2.8.0'
Matthew Treinish83e166b2015-02-18 19:01:20 -0500704 pushd $TEMPEST_DIR
Ghanshyame1c04062020-01-29 15:39:17 -0600705 # NOTE(gmann): checkout the TEMPEST_BRANCH in case TEMPEST_BRANCH
706 # is tag name not master. git_clone would not checkout tag because
707 # TEMPEST_DIR already exist until RECLONE is true.
708 git checkout $TEMPEST_BRANCH
709
Ghanshyam Mann3bdc8f62021-02-09 12:56:34 -0600710 local tmp_u_c_m
711 tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
712 set_tempest_venv_constraints $tmp_u_c_m
713
Sean Dague583c5202017-03-21 11:15:05 -0400714 tox -r --notest -efull
Matthew Treinish1e31e682016-02-09 23:50:54 -0500715 # NOTE(mtreinish) Respect constraints in the tempest full venv, things that
716 # are using a tox job other than full will not be respecting constraints but
717 # running pip install -U on tempest requirements
Ghanshyam Mann3bdc8f62021-02-09 12:56:34 -0600718 $TEMPEST_DIR/.tox/tempest/bin/pip install -c $tmp_u_c_m -r requirements.txt
Matthew Treinish440464c2016-05-04 11:55:12 -0400719 PROJECT_VENV["tempest"]=${TEMPEST_DIR}/.tox/tempest
Ghanshyam Mann3bdc8f62021-02-09 12:56:34 -0600720 rm -f $tmp_u_c_m
Matthew Treinish7e603d12016-06-01 18:16:14 -0400721 popd
722}
723
724# install_tempest_plugins() - Install any specified plugins into the tempest venv
725function install_tempest_plugins {
726 pushd $TEMPEST_DIR
Matthew Treinish440464c2016-05-04 11:55:12 -0400727 if [[ $TEMPEST_PLUGINS != 0 ]] ; then
Rodolfo Alonso Hernandez8579f582019-11-04 11:37:54 +0000728 local tmp_u_c_m
729 tmp_u_c_m=$(mktemp -t tempest_u_c_m.XXXXXXXXXX)
Ghanshyam Mann3bdc8f62021-02-09 12:56:34 -0600730 set_tempest_venv_constraints $tmp_u_c_m
Rodolfo Alonso Hernandez8579f582019-11-04 11:37:54 +0000731 tox -evenv-tempest -- pip install -c $tmp_u_c_m $TEMPEST_PLUGINS
732 rm -f $tmp_u_c_m
Matthew Treinishb6558672016-05-20 17:30:17 -0400733 echo "Checking installed Tempest plugins:"
734 tox -evenv-tempest -- tempest list-plugins
Matthew Treinishb31640a2016-05-02 16:33:29 -0400735 fi
Matthew Treinish83e166b2015-02-18 19:01:20 -0500736 popd
Sean Dagued0931212012-10-04 16:06:44 -0400737}
738
Sean Dagued0931212012-10-04 16:06:44 -0400739# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +1100740$_XTRACE_TEMPEST
Sean Dague584d90e2013-03-29 14:34:53 -0400741
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100742# Tell emacs to use shell-script-mode
743## Local variables:
744## mode: shell-script
745## End: