blob: 00e946e549dedee75f88f067ccb4e6573d636e9a [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``
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +000030# - ``CINDER_ENABLED_BACKENDS``
Matt Riedemann89ee5852015-07-09 13:25:04 -070031# - ``NOVA_ALLOW_DUPLICATE_NETWORKS``
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010032#
Sean Dagued0931212012-10-04 16:06:44 -040033# ``stack.sh`` calls the entry points in this order:
34#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010035# - install_tempest
36# - configure_tempest
Sean Dagued0931212012-10-04 16:06:44 -040037
38# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +110039_XTRACE_TEMPEST=$(set +o | grep xtrace)
Sean Dagued0931212012-10-04 16:06:44 -040040set +o xtrace
41
Dean Troyer6d04fd72012-12-21 11:03:37 -060042
Sean Dagued0931212012-10-04 16:06:44 -040043# Defaults
44# --------
45
Sean Dagued0931212012-10-04 16:06:44 -040046# Set up default directories
47TEMPEST_DIR=$DEST/tempest
john-griffithdc4dc7f2014-01-22 18:09:32 -070048TEMPEST_CONFIG_DIR=${TEMPEST_CONFIG_DIR:-$TEMPEST_DIR/etc}
49TEMPEST_CONFIG=$TEMPEST_CONFIG_DIR/tempest.conf
Matthew Treinish14ccba02013-07-29 16:15:53 -040050TEMPEST_STATE_PATH=${TEMPEST_STATE_PATH:=$DATA_DIR/tempest}
Attila Fazekas2aa35172012-12-05 20:03:40 +010051
Arx Cruz1bde9b42014-07-18 11:34:33 -030052# This is the timeout that tempest will wait for a VM to change state,
53# spawn, delete, etc.
54# The default is set to 196 seconds.
55BUILD_TIMEOUT=${BUILD_TIMEOUT:-196}
Sean Dagued0931212012-10-04 16:06:44 -040056
Joe Gordonc9b245b2015-02-10 14:32:39 -080057# This must be False on stable branches, as master tempest
58# deps do not match stable branch deps. Set this to True to
Dean Troyerdc97cb72015-03-28 08:20:50 -050059# have tempest installed in DevStack by default.
Matthew Treinishcb3cece2015-03-16 10:37:51 -040060INSTALL_TEMPEST=${INSTALL_TEMPEST:-"True"}
Joe Gordonc9b245b2015-02-10 14:32:39 -080061
Matthew Treinish440464c2016-05-04 11:55:12 -040062# This variable is passed directly to pip install inside the common tox venv
63# that is created
64TEMPEST_PLUGINS=${TEMPEST_PLUGINS:-0}
65
john-griffithdc4dc7f2014-01-22 18:09:32 -070066# Cinder/Volume variables
67TEMPEST_VOLUME_DRIVER=${TEMPEST_VOLUME_DRIVER:-default}
Eric Harney01456482014-10-14 18:53:53 -040068TEMPEST_DEFAULT_VOLUME_VENDOR="Open Source"
69TEMPEST_VOLUME_VENDOR=${TEMPEST_VOLUME_VENDOR:-$TEMPEST_DEFAULT_VOLUME_VENDOR}
70TEMPEST_DEFAULT_STORAGE_PROTOCOL="iSCSI"
71TEMPEST_STORAGE_PROTOCOL=${TEMPEST_STORAGE_PROTOCOL:-$TEMPEST_DEFAULT_STORAGE_PROTOCOL}
Dean Troyercc6b4432013-04-08 15:38:03 -050072
armando-migliaccio71ef61a2014-02-19 22:19:24 -080073# Neutron/Network variables
Sean Dague53753292014-12-04 19:38:15 -050074IPV6_ENABLED=$(trueorfalse True IPV6_ENABLED)
75IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True IPV6_SUBNET_ATTRIBUTES_ENABLED)
armando-migliaccio71ef61a2014-02-19 22:19:24 -080076
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040077# Do we want to make a configuration where Tempest has admin on
78# the cloud. We don't always want to so that we can ensure Tempest
79# would work on a public cloud.
80TEMPEST_HAS_ADMIN=$(trueorfalse True TEMPEST_HAS_ADMIN)
81
82# Credential provider configuration option variables
83TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-$TEMPEST_HAS_ADMIN}
Matthew Treinish403fbb12015-08-24 21:17:37 -040084TEMPEST_USE_TEST_ACCOUNTS=$(trueorfalse False TEMPEST_USE_TEST_ACCOUNTS)
Matthew Treinishdf8f43b2015-08-09 20:30:39 -040085
86# The number of workers tempest is expected to be run with. This is used for
87# generating a accounts.yaml for running with test-accounts. This is also the
88# same variable that devstack-gate uses to specify the number of workers that
89# it will run tempest with
90TEMPEST_CONCURRENCY=${TEMPEST_CONCURRENCY:-$(nproc)}
91
Dean Troyerdc97cb72015-03-28 08:20:50 -050092
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
Sean Dagued0931212012-10-04 16:06:44 -0400105# configure_tempest() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +1100106function configure_tempest {
Joe Gordonc9b245b2015-02-10 14:32:39 -0800107 if [[ "$INSTALL_TEMPEST" == "True" ]]; then
108 setup_develop $TEMPEST_DIR
109 else
110 # install testr since its used to process tempest logs
Sean Dague60996b12015-04-08 09:06:49 -0400111 pip_install_gr testrepository
Joe Gordonc9b245b2015-02-10 14:32:39 -0800112 fi
Joe Gordond5ac7852015-02-06 19:29:23 -0800113
Attila Fazekas65c08462012-12-07 14:20:51 +0100114 local image_lines
115 local images
116 local num_images
117 local image_uuid
118 local image_uuid_alt
Attila Fazekas65c08462012-12-07 14:20:51 +0100119 local password
120 local line
121 local flavors
Clark Boylan3b80bde2013-11-20 17:51:50 -0800122 local available_flavors
Attila Fazekas65c08462012-12-07 14:20:51 +0100123 local flavors_ref
124 local flavor_lines
Maru Newbya5c774e2012-12-10 10:40:01 +0000125 local public_network_id
Maru Newby31c94ab2012-12-19 03:59:20 +0000126 local public_router_id
Sean Dague5544c4a2016-01-25 08:27:06 -0500127 local ssh_connect_method="floating"
Attila Fazekas2aa35172012-12-05 20:03:40 +0100128
Dean Troyer6d04fd72012-12-21 11:03:37 -0600129 # Save IFS
Attila Fazekas2aa35172012-12-05 20:03:40 +0100130 ifs=$IFS
131
132 # Glance should already contain images to be used in tempest
133 # testing. Here we simply look for images stored in Glance
134 # and set the appropriate variables for use in the tempest config
135 # We ignore ramdisk and kernel images, look for the default image
Attila Fazekas65c08462012-12-07 14:20:51 +0100136 # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
137 # first image returned and set ``image_uuid_alt`` to the second,
Attila Fazekas2aa35172012-12-05 20:03:40 +0100138 # if there is more than one returned...
139 # ... Also ensure we only take active images, so we don't get snapshots in process
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500140 declare -a images
141
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200142 if is_service_enabled glance; then
143 while read -r IMAGE_NAME IMAGE_UUID; do
144 if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
145 image_uuid="$IMAGE_UUID"
146 image_uuid_alt="$IMAGE_UUID"
147 fi
148 images+=($IMAGE_UUID)
Swapnil Kulkarnia747cd22015-05-13 09:26:15 +0000149 done < <(openstack image list --property status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
Cody A.W. Somervillec24e23b2012-12-21 02:10:45 -0500150
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200151 case "${#images[*]}" in
152 0)
153 echo "Found no valid images to use!"
154 exit 1
155 ;;
156 1)
157 if [ -z "$image_uuid" ]; then
158 image_uuid=${images[0]}
159 image_uuid_alt=${images[0]}
160 fi
161 ;;
162 *)
163 if [ -z "$image_uuid" ]; then
164 image_uuid=${images[0]}
165 image_uuid_alt=${images[1]}
166 fi
167 ;;
168 esac
169 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100170
Matthew Treinish93c10572015-07-31 10:38:50 -0400171 # (Re)create ``tempest.conf``
172 # Create every time because the image UUIDS are going to change
Dean Troyer8421c2b2015-03-16 13:52:19 -0500173 sudo install -d -o $STACK_USER $TEMPEST_CONFIG_DIR
Matthew Treinish93c10572015-07-31 10:38:50 -0400174 rm -f $TEMPEST_CONFIG
Attila Fazekas2aa35172012-12-05 20:03:40 +0100175
Balagopal7ed812c2016-03-01 04:43:31 +0000176 local password=${ADMIN_PASSWORD:-secret}
Attila Fazekas2aa35172012-12-05 20:03:40 +0100177
Dean Troyerdc97cb72015-03-28 08:20:50 -0500178 # See ``lib/keystone`` where these users and tenants are set up
Sean Dague0f765352016-02-18 06:53:08 -0500179 local admin_username=${ADMIN_USERNAME:-admin}
Sean Dague76392b52016-04-04 09:07:08 -0400180 local admin_project_name=${ADMIN_TENANT_NAME:-admin}
Sean Dague0f765352016-02-18 06:53:08 -0500181 local admin_domain_name=${ADMIN_DOMAIN_NAME:-Default}
Sean Dague0f765352016-02-18 06:53:08 -0500182 local alt_username=${ALT_USERNAME:-alt_demo}
Sean Dague76392b52016-04-04 09:07:08 -0400183 local alt_project_name=${ALT_TENANT_NAME:-alt_demo}
184 local admin_project_id
185 admin_project_id=$(openstack project list | awk "/ admin / { print \$2 }")
Attila Fazekas2aa35172012-12-05 20:03:40 +0100186
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200187 if is_service_enabled nova; then
Dean Troyerdc97cb72015-03-28 08:20:50 -0500188 # If ``DEFAULT_INSTANCE_TYPE`` is not declared, use the new behavior
189 # Tempest creates its own instance types
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600190 available_flavors=$(nova flavor-list)
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200191 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200192 if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
Jordan Pittier82fa9462016-11-02 11:15:42 +0100193 openstack flavor create --id 42 --ram 64 --disk 0 --vcpus 1 m1.nano
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200194 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200195 flavor_ref=42
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200196 if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
Jordan Pittier82fa9462016-11-02 11:15:42 +0100197 openstack flavor create --id 84 --ram 128 --disk 0 --vcpus 1 m1.micro
Rafael Folcoba0f1d32013-12-06 17:56:24 -0200198 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200199 flavor_ref_alt=84
200 else
Dean Troyerdc97cb72015-03-28 08:20:50 -0500201 # Check Nova for existing flavors, if ``DEFAULT_INSTANCE_TYPE`` is set use it.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200202 IFS=$'\r\n'
203 flavors=""
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600204 for line in $available_flavors; do
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200205 f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
206 flavors="$flavors $f"
207 done
Attila Fazekas2aa35172012-12-05 20:03:40 +0100208
Rafael Folco0b4c83a2015-11-26 10:08:36 -0600209 for line in $available_flavors; do
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200210 flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
211 done
Attila Fazekas7bf1dd32013-01-12 17:31:26 +0100212
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200213 IFS=" "
214 flavors=($flavors)
215 num_flavors=${#flavors[*]}
216 echo "Found $num_flavors flavors"
217 if [[ $num_flavors -eq 0 ]]; then
218 echo "Found no valid flavors to use!"
219 exit 1
Adalberto Medeiros63a71a22013-06-06 08:46:04 -0400220 fi
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200221 flavor_ref=${flavors[0]}
222 flavor_ref_alt=$flavor_ref
223
Dean Troyerdc97cb72015-03-28 08:20:50 -0500224 # Ensure ``flavor_ref`` and ``flavor_ref_alt`` have different values.
225 # Some resize instance in tempest tests depends on this.
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200226 for f in ${flavors[@]:1}; do
John L. Villalovos3345a6d2017-03-13 13:47:34 -0700227 if [[ "$f" != "$flavor_ref" ]]; then
Attila Fazekasc411fcf2014-08-19 16:48:14 +0200228 flavor_ref_alt=$f
229 break
230 fi
231 done
232 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100233 fi
234
Dan Smitha2ec7fd2016-08-10 11:14:00 -0700235 iniset $TEMPEST_CONFIG network project_network_cidr $FIXED_RANGE
236
Attila Fazekas386ae8c2013-10-21 09:27:18 +0200237 ssh_connect_method=${TEMPEST_SSH_CONNECT_METHOD:-$ssh_connect_method}
238
Armando Migliaccio53f59d82016-05-17 15:12:24 -0700239 # the public network (for floating ip access) is only available
240 # if the extension is enabled.
Eric Berglund8e142402016-11-29 17:33:28 -0600241 # If NEUTRON_CREATE_INITIAL_NETWORKS is not true, there is no network created
242 # and the public_network_id should not be set.
243 if [[ "$NEUTRON_CREATE_INITIAL_NETWORKS" == "True" ]] && is_networking_extension_supported 'external-net'; then
Jordan Pittierd038b602016-11-04 13:32:39 +0100244 public_network_id=$(openstack network show -f value -c id $PUBLIC_NETWORK_NAME)
Maru Newbya5c774e2012-12-10 10:40:01 +0000245 fi
246
Masayuki Igawa5a252d92014-11-21 21:55:09 +0900247 iniset $TEMPEST_CONFIG DEFAULT use_syslog $SYSLOG
Dean Troyerdc97cb72015-03-28 08:20:50 -0500248
Matthew Treinish859cc682013-07-26 15:22:44 -0400249 # Oslo
Joe Gordon23d6d502015-03-06 15:24:22 -0800250 iniset $TEMPEST_CONFIG oslo_concurrency lock_path $TEMPEST_STATE_PATH
Matthew Treinish14ccba02013-07-29 16:15:53 -0400251 mkdir -p $TEMPEST_STATE_PATH
john-griffithdc4dc7f2014-01-22 18:09:32 -0700252 iniset $TEMPEST_CONFIG DEFAULT use_stderr False
253 iniset $TEMPEST_CONFIG DEFAULT log_file tempest.log
254 iniset $TEMPEST_CONFIG DEFAULT debug True
Matthew Treinish859cc682013-07-26 15:22:44 -0400255
Attila Fazekas2aa35172012-12-05 20:03:40 +0100256 # Timeouts
john-griffithdc4dc7f2014-01-22 18:09:32 -0700257 iniset $TEMPEST_CONFIG compute build_timeout $BUILD_TIMEOUT
258 iniset $TEMPEST_CONFIG volume build_timeout $BUILD_TIMEOUT
Attila Fazekas2aa35172012-12-05 20:03:40 +0100259
Attila Fazekas97d3d202013-01-19 19:20:49 +0100260 # Identity
Brant Knudsonc2c89e42017-02-23 20:15:47 -0600261 iniset $TEMPEST_CONFIG identity uri "$KEYSTONE_SERVICE_URI/v2.0/"
Steve Martinellib74e01c2014-12-18 01:35:35 -0500262 iniset $TEMPEST_CONFIG identity uri_v3 "$KEYSTONE_SERVICE_URI_V3"
Rodrigo Duarteb51a8862016-09-26 15:22:35 -0300263 iniset $TEMPEST_CONFIG identity user_lockout_failure_attempts $KEYSTONE_LOCKOUT_FAILURE_ATTEMPTS
264 iniset $TEMPEST_CONFIG identity user_lockout_duration $KEYSTONE_LOCKOUT_DURATION
265 iniset $TEMPEST_CONFIG identity user_unique_last_password_count $KEYSTONE_UNIQUE_LAST_PASSWORD_COUNT
Andrea Frittoli (andreaf)5cda4912016-06-09 00:33:30 +0100266 # Use domain scoped tokens for admin v3 tests, v3 dynamic credentials of v3 account generation
267 iniset $TEMPEST_CONFIG identity admin_domain_scope True
Matthew Treinish7ced1502015-03-23 15:51:54 -0400268 if [[ "$TEMPEST_HAS_ADMIN" == "True" ]]; then
Sean Dague0f765352016-02-18 06:53:08 -0500269 iniset $TEMPEST_CONFIG auth admin_username $admin_username
Matthew Treinishfbe0a622015-12-10 19:36:50 -0500270 iniset $TEMPEST_CONFIG auth admin_password "$password"
Castulo J. Martinez2d9959c2016-11-01 13:34:20 -0700271 iniset $TEMPEST_CONFIG auth admin_project_name $admin_project_name
Sean Dague0f765352016-02-18 06:53:08 -0500272 iniset $TEMPEST_CONFIG auth admin_domain_name $admin_domain_name
Matthew Treinish7ced1502015-03-23 15:51:54 -0400273 fi
Paulo Ewerton75bf9722016-01-22 19:13:31 +0000274 if [ "$ENABLE_IDENTITY_V2" == "True" ]; then
275 # Run Identity API v2 tests ONLY if needed
276 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 True
Paulo Ewerton75bf9722016-01-22 19:13:31 +0000277 else
278 # Skip Identity API v2 tests by default
279 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2 False
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300280 fi
Ken'ichi Ohmichidc6e5502017-03-03 16:55:50 -0800281 iniset $TEMPEST_CONFIG identity auth_version ${TEMPEST_AUTH_VERSION:-v3}
ghanshyam11b86492018-08-07 08:37:24 +0000282 if [[ "$TEMPEST_AUTH_VERSION" != "v2" ]]; then
283 # we're going to disable v2 admin unless we're using v2 by default.
Sean Daguebb443112017-04-19 16:22:42 -0400284 iniset $TEMPEST_CONFIG identity-feature-enabled api_v2_admin False
285 fi
Samuel de Medeiros Queiroz3fd71d62015-05-03 14:54:45 -0300286
Sean Daguef3b2f4c2017-04-13 10:11:48 -0400287 if is_service_enabled tls-proxy; then
Rob Crittendene1d013f2015-02-10 14:15:35 -0500288 iniset $TEMPEST_CONFIG identity ca_certificates_file $SSL_BUNDLE_FILE
289 fi
Attila Fazekas2aa35172012-12-05 20:03:40 +0100290
Rodrigo Duarte0578e422016-03-16 12:15:07 -0300291 # Identity Features
Rodrigo Duarteb51a8862016-09-26 15:22:35 -0300292 if [[ "$KEYSTONE_SECURITY_COMPLIANCE_ENABLED" = True ]]; then
293 iniset $TEMPEST_CONFIG identity-feature-enabled security_compliance True
294 fi
Rodrigo Duarte0578e422016-03-16 12:15:07 -0300295
Leticia Wanderley1d141da2017-08-04 00:42:59 -0300296 # When LDAP is enabled domain specific drivers are also enabled and the users
297 # and groups identity tests must adapt to this scenario
298 if is_service_enabled ldap; then
299 iniset $TEMPEST_CONFIG identity-feature-enabled domain_specific_drivers True
300 fi
301
Felipe Monteiro1ab9a2d2018-03-16 02:02:12 +0000302 # TODO(felipemonteiro): Remove this once Tempest no longer supports Pike
303 # as this is supported in Queens and beyond.
304 iniset $TEMPEST_CONFIG identity-feature-enabled project_tags True
305
Colleen Murphy931f82d2018-02-18 14:11:10 +0100306 # In Queens and later, application credentials are enabled by default
307 # so remove this once Tempest no longer supports Pike.
308 iniset $TEMPEST_CONFIG identity-feature-enabled application_credentials True
309
Sean Daguec3771452013-06-13 14:23:37 -0400310 # Image
Dean Troyerdc97cb72015-03-28 08:20:50 -0500311 # We want to be able to override this variable in the gate to avoid
312 # doing an external HTTP fetch for this test.
Sean Daguec3771452013-06-13 14:23:37 -0400313 if [[ ! -z "$TEMPEST_HTTP_IMAGE" ]]; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700314 iniset $TEMPEST_CONFIG image http_image $TEMPEST_HTTP_IMAGE
Sean Daguec3771452013-06-13 14:23:37 -0400315 fi
Bob Ball2dd761b2016-01-15 13:56:37 +0000316 if [ "$VIRT_DRIVER" = "xenserver" ]; then
317 iniset $TEMPEST_CONFIG image disk_formats "ami,ari,aki,vhd,raw,iso"
318 fi
Sean Daguec3771452013-06-13 14:23:37 -0400319
David Kranzf100e1c2015-06-01 10:29:59 -0400320 # Image Features
Flavio Percoco22c695f2016-05-11 12:49:07 -0500321 if [ "$GLANCE_V1_ENABLED" != "True" ]; then
322 iniset $TEMPEST_CONFIG image-feature-enabled api_v1 False
323 fi
David Kranzf100e1c2015-06-01 10:29:59 -0400324
Attila Fazekas97d3d202013-01-19 19:20:49 +0100325 # Compute
john-griffithdc4dc7f2014-01-22 18:09:32 -0700326 iniset $TEMPEST_CONFIG compute image_ref $image_uuid
john-griffithdc4dc7f2014-01-22 18:09:32 -0700327 iniset $TEMPEST_CONFIG compute image_ref_alt $image_uuid_alt
john-griffithdc4dc7f2014-01-22 18:09:32 -0700328 iniset $TEMPEST_CONFIG compute flavor_ref $flavor_ref
329 iniset $TEMPEST_CONFIG compute flavor_ref_alt $flavor_ref_alt
Sean Dague563a7e72015-12-15 17:16:19 -0500330 iniset $TEMPEST_CONFIG validation connect_method $ssh_connect_method
Luigi Toscano4c813ac2016-09-21 19:39:36 +0200331 if ! is_service_enabled n-cell && ! is_service_enabled neutron; then
melanie wittf5b550e2015-04-10 22:20:07 +0000332 iniset $TEMPEST_CONFIG compute fixed_network_name $PRIVATE_NETWORK_NAME
333 fi
Attila Fazekas97d3d202013-01-19 19:20:49 +0100334
Sean Dague8349aff2015-09-01 12:45:28 -0400335 # Set the service catalog entry for Tempest to run on. Typically
336 # used to try different compute API version targets. The tempest
337 # default if 'compute', which is typically valid, so only set this
338 # if you want to change it.
339 if [[ -n "$TEMPEST_COMPUTE_TYPE" ]]; then
340 iniset $TEMPEST_CONFIG compute catalog_type $TEMPEST_COMPUTE_TYPE
341 fi
342
Sean Daguede19bf92014-03-20 16:54:58 -0400343 # Compute Features
ghanshyam642b07b2015-11-19 10:01:14 +0900344 # Set the microversion range for compute tests.
345 # This is used to run the Nova microversions tests.
346 # Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
347 # NOTE- To avoid microversion tests failure on stable branch, we need to change "tempest_compute_max_microversion"
348 # for stable branch on each release which should be changed from "latest" to max supported version of that release.
349 local tempest_compute_min_microversion=${TEMPEST_COMPUTE_MIN_MICROVERSION:-None}
350 local tempest_compute_max_microversion=${TEMPEST_COMPUTE_MAX_MICROVERSION:-"latest"}
351 # Reset microversions to None where v2.0 is running which does not support microversion.
352 # Both "None" means no microversion testing.
353 if [[ "$TEMPEST_COMPUTE_TYPE" == "compute_legacy" ]]; then
354 tempest_compute_min_microversion=None
355 tempest_compute_max_microversion=None
356 fi
357 if [ "$tempest_compute_min_microversion" == "None" ]; then
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200358 inicomment $TEMPEST_CONFIG compute min_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900359 else
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200360 iniset $TEMPEST_CONFIG compute min_microversion $tempest_compute_min_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900361 fi
362 if [ "$tempest_compute_max_microversion" == "None" ]; then
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200363 inicomment $TEMPEST_CONFIG compute max_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900364 else
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200365 iniset $TEMPEST_CONFIG compute max_microversion $tempest_compute_max_microversion
ghanshyam642b07b2015-11-19 10:01:14 +0900366 fi
367
Matt Riedemann6d3670a2016-07-03 19:40:25 -0400368 iniset $TEMPEST_CONFIG compute-feature-enabled personality ${ENABLE_FILE_INJECTION:-False}
Sean Daguede19bf92014-03-20 16:54:58 -0400369 iniset $TEMPEST_CONFIG compute-feature-enabled resize True
Matthew Treinish270f93e2014-03-20 21:18:42 +0000370 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
371 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
372 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 +0200373 iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_back_and_forth ${LIVE_MIGRATE_BACK_AND_FORTH:-False}
Matt Riedemanne57a3322015-06-20 14:48:00 -0700374 iniset $TEMPEST_CONFIG compute-feature-enabled attach_encrypted_volume ${ATTACH_ENCRYPTED_VOLUME_AVAILABLE:-True}
Chuck Carmack09b431d2015-09-02 14:27:58 +0000375 if is_service_enabled n-cell; then
376 # Cells doesn't support shelving/unshelving
377 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
Matt Riedemannc94403d2015-10-15 12:51:13 -0700378 # Cells doesn't support hot-plugging virtual interfaces.
379 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
Matt Riedemann2bebf2d2016-04-05 10:34:42 -0400380 # Cells v1 doesn't support the rescue/unrescue tests in Tempest
381 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
Matt Riedemann6cd616a2015-11-06 10:26:14 -0800382
383 if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
384 # Cells supports resize but does not currently work with devstack
385 # because of the custom flavors created for Tempest runs which are
386 # not in the cells database.
387 # TODO(mriedem): work on adding a nova-manage command to sync
388 # flavors into the cells database.
389 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
390 fi
Chuck Carmack09b431d2015-09-02 14:27:58 +0000391 fi
Sean Daguede19bf92014-03-20 16:54:58 -0400392
Matt Riedemannffe691e2016-01-12 17:58:44 -0800393 if [[ $ENABLE_VOLUME_MULTIATTACH == "True" ]]; then
394 iniset $TEMPEST_CONFIG compute-feature-enabled volume_multiattach True
395 fi
396
melanie witt6645cf72017-12-13 23:59:09 +0000397 if is_service_enabled n-novnc; then
Michelle Mandel10db2b82016-07-20 11:39:42 -0400398 iniset $TEMPEST_CONFIG compute-feature-enabled vnc_console True
399 fi
400
Marian Horbanea21eb42015-08-18 06:57:18 -0400401 # Network
Jordan Pittierf5a50a02016-05-10 14:56:12 +0200402 iniset $TEMPEST_CONFIG network project_networks_reachable false
john-griffithdc4dc7f2014-01-22 18:09:32 -0700403 iniset $TEMPEST_CONFIG network public_network_id "$public_network_id"
404 iniset $TEMPEST_CONFIG network public_router_id "$public_router_id"
405 iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
Matthew Treinishccf60f72014-03-03 22:48:31 -0500406 iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
Sean M. Collinsbb2908b2014-05-15 10:24:31 -0400407 iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
Matt Riedemannc9c9d312016-09-15 20:33:22 -0400408 iniset $TEMPEST_CONFIG network-feature-enabled port_security $NEUTRON_PORT_SECURITY
Salvatore33e8ee22014-10-05 01:36:34 +0200409
William Marshall24d866e2013-07-02 12:26:31 -0500410 # Scenario
Jianghua Wang2b3ac6d2016-11-09 12:50:00 +0800411 if [ "$VIRT_DRIVER" = "xenserver" ]; then
412 SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES}
413 SCENARIO_IMAGE_FILE="cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.vhd.tgz"
414 iniset $TEMPEST_CONFIG scenario img_disk_format vhd
415 iniset $TEMPEST_CONFIG scenario img_container_format ovf
416 else
Matthew Treinish6fc332d2016-07-06 13:44:55 -0400417 SCENARIO_IMAGE_DIR=${SCENARIO_IMAGE_DIR:-$FILES}
Matthew Treinishbefe0922017-02-16 15:45:11 -0500418 SCENARIO_IMAGE_FILE=$DEFAULT_IMAGE_FILE_NAME
Jianghua Wang2b3ac6d2016-11-09 12:50:00 +0800419 fi
Matthew Treinishd2cb2342015-04-02 11:08:24 -0400420 iniset $TEMPEST_CONFIG scenario img_dir $SCENARIO_IMAGE_DIR
Jianghua Wang2b3ac6d2016-11-09 12:50:00 +0800421 iniset $TEMPEST_CONFIG scenario img_file $SCENARIO_IMAGE_FILE
William Marshall24d866e2013-07-02 12:26:31 -0500422
Michael Turek7938d832016-04-12 14:55:21 -0400423 # If using provider networking, use the physical network for validation rather than private
424 TEMPEST_SSH_NETWORK_NAME=$PRIVATE_NETWORK_NAME
425 if is_provider_network; then
426 TEMPEST_SSH_NETWORK_NAME=$PHYSICAL_NETWORK
427 fi
lanoux994db612015-08-03 13:48:12 +0000428 # Validation
Andrea Frittolief1e88e2017-04-20 23:37:32 +0100429 iniset $TEMPEST_CONFIG validation run_validation ${TEMPEST_RUN_VALIDATION:-True}
Matthew Treinishfbe0a622015-12-10 19:36:50 -0500430 iniset $TEMPEST_CONFIG validation ip_version_for_ssh 4
431 iniset $TEMPEST_CONFIG validation ssh_timeout $BUILD_TIMEOUT
432 iniset $TEMPEST_CONFIG validation image_ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
Michael Turek7938d832016-04-12 14:55:21 -0400433 iniset $TEMPEST_CONFIG validation network_for_ssh $TEMPEST_SSH_NETWORK_NAME
lanoux994db612015-08-03 13:48:12 +0000434
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200435 # Volume
ghanshyam7a8d8502017-12-14 09:16:56 +0000436 # Set the service catalog entry for Tempest to run on. Typically
437 # used to try different Volume API version targets. The tempest
438 # default it to 'volumev3'(v3 APIs endpoint) , so only set this
439 # if you want to change it.
440 if [[ -n "$TEMPEST_VOLUME_TYPE" ]]; then
441 iniset $TEMPEST_CONFIG volume catalog_type $TEMPEST_VOLUME_TYPE
442 fi
Patrick East3eb7c972017-01-13 11:44:54 -0800443 # Only turn on TEMPEST_VOLUME_MANAGE_SNAPSHOT by default for "lvm" backends
444 if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]]; then
445 TEMPEST_VOLUME_MANAGE_SNAPSHOT=${TEMPEST_VOLUME_MANAGE_SNAPSHOT:-True}
446 fi
447 iniset $TEMPEST_CONFIG volume-feature-enabled manage_snapshot $(trueorfalse False TEMPEST_VOLUME_MANAGE_SNAPSHOT)
jeremy.zhangd5919d02017-03-08 15:27:37 +0800448 # Only turn on TEMPEST_VOLUME_MANAGE_VOLUME by default for "lvm" backends
449 if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]]; then
450 TEMPEST_VOLUME_MANAGE_VOLUME=${TEMPEST_VOLUME_MANAGE_VOLUME:-True}
451 fi
452 iniset $TEMPEST_CONFIG volume-feature-enabled manage_volume $(trueorfalse False TEMPEST_VOLUME_MANAGE_VOLUME)
Matt Riedemann17cdecc2017-07-05 20:25:02 -0400453 # Only turn on TEMPEST_EXTEND_ATTACHED_VOLUME by default for "lvm" backends
454 # in Cinder and the libvirt driver in Nova.
455 if [[ "$CINDER_ENABLED_BACKENDS" == *"lvm"* ]] && [ "$VIRT_DRIVER" = "libvirt" ]; then
456 TEMPEST_EXTEND_ATTACHED_VOLUME=${TEMPEST_EXTEND_ATTACHED_VOLUME:-True}
457 fi
458 iniset $TEMPEST_CONFIG volume-feature-enabled extend_attached_volume $(trueorfalse False TEMPEST_EXTEND_ATTACHED_VOLUME)
Alex Meade0c0c09a2016-05-13 10:57:29 -0400459 local tempest_volume_min_microversion=${TEMPEST_VOLUME_MIN_MICROVERSION:-None}
460 local tempest_volume_max_microversion=${TEMPEST_VOLUME_MAX_MICROVERSION:-"latest"}
ghanshyam7a8d8502017-12-14 09:16:56 +0000461 # Reset microversions to None where v2 is running which does not support microversion.
462 # Both "None" means no microversion testing.
463 if [[ "$TEMPEST_VOLUME_TYPE" == "volumev2" ]]; then
464 tempest_volume_min_microversion=None
465 tempest_volume_max_microversion=None
466 fi
Alex Meade0c0c09a2016-05-13 10:57:29 -0400467 if [ "$tempest_volume_min_microversion" == "None" ]; then
468 inicomment $TEMPEST_CONFIG volume min_microversion
469 else
470 iniset $TEMPEST_CONFIG volume min_microversion $tempest_volume_min_microversion
471 fi
472
473 if [ "$tempest_volume_max_microversion" == "None" ]; then
474 inicomment $TEMPEST_CONFIG volume max_microversion
475 else
476 iniset $TEMPEST_CONFIG volume max_microversion $tempest_volume_max_microversion
477 fi
David Kranzd1d66672015-06-11 13:09:37 -0400478
Giulio Fidente3d60f4d2014-02-20 16:43:49 +0100479 if ! is_service_enabled c-bak; then
480 iniset $TEMPEST_CONFIG volume-feature-enabled backup False
Giulio Fidente3632ab12013-09-10 02:51:26 +0200481 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000482
Dean Troyerdc97cb72015-03-28 08:20:50 -0500483 # Using ``CINDER_ENABLED_BACKENDS``
bkopilov3ac1ea82016-06-06 16:00:48 +0300484 # Cinder uses a comma separated list with "type:backend_name":
485 # CINDER_ENABLED_BACKENDS = ceph:cephBE1,lvm:lvmBE2,foo:my_foo
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000486 if [[ -n "$CINDER_ENABLED_BACKENDS" ]] && [[ $CINDER_ENABLED_BACKENDS =~ .*,.* ]]; then
bkopilov3ac1ea82016-06-06 16:00:48 +0300487 # We have at least 2 backends
Matthew Treinishdb1c3842014-02-04 20:58:00 +0000488 iniset $TEMPEST_CONFIG volume-feature-enabled multi_backend "True"
bkopilov3ac1ea82016-06-06 16:00:48 +0300489 local add_comma_seperator=0
490 local backends_list=''
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000491 local be
bkopilov3ac1ea82016-06-06 16:00:48 +0300492 # Tempest uses a comma separated list of backend_names:
493 # backend_names = BACKEND_1,BACKEND_2
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000494 for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
bkopilov3ac1ea82016-06-06 16:00:48 +0300495 if [ "$add_comma_seperator" -eq "1" ]; then
496 backends_list+=,${be##*:}
497 else
498 # first element in the list
499 backends_list+=${be##*:}
500 add_comma_seperator=1
501 fi
Swapnil Kulkarni09fb7ba2014-10-16 06:30:28 +0000502 done
bkopilov3ac1ea82016-06-06 16:00:48 +0300503 iniset $TEMPEST_CONFIG volume "backend_names" "$backends_list"
john-griffithdc4dc7f2014-01-22 18:09:32 -0700504 fi
505
Eric Harney01456482014-10-14 18:53:53 -0400506 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
Patrick East1c0628f2014-10-22 16:22:47 -0700507 "$TEMPEST_VOLUME_VENDOR" != "$TEMPEST_DEFAULT_VOLUME_VENDOR" ]; then
Ed Balduf2f23d752014-07-29 14:42:27 -0600508 iniset $TEMPEST_CONFIG volume vendor_name "$TEMPEST_VOLUME_VENDOR"
Eric Harney01456482014-10-14 18:53:53 -0400509 fi
510 if [ $TEMPEST_VOLUME_DRIVER != "default" -o \
JordanP82a7d932014-12-04 14:09:16 +0100511 "$TEMPEST_STORAGE_PROTOCOL" != "$TEMPEST_DEFAULT_STORAGE_PROTOCOL" ]; then
512 iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
Giulio Fidente97e1bd02013-06-04 05:33:52 +0200513 fi
514
Adam Gandelman43bd6672014-04-03 11:13:13 -0700515 # Baremetal
516 if [ "$VIRT_DRIVER" = "ironic" ] ; then
Adam Gandelmanfdfe7a02014-07-24 10:06:18 -0400517 iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
518 iniset $TEMPEST_CONFIG compute-feature-enabled console_output False
519 iniset $TEMPEST_CONFIG compute-feature-enabled interface_attach False
520 iniset $TEMPEST_CONFIG compute-feature-enabled live_migration False
521 iniset $TEMPEST_CONFIG compute-feature-enabled pause False
522 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
523 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
524 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
525 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
David Shrewsburycf21b712014-08-13 07:03:58 -0400526 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Adam Gandelman43bd6672014-04-03 11:13:13 -0700527 fi
528
Matt Riedemann92575ba2016-09-21 16:15:31 -0400529 # Libvirt
530 if [ "$VIRT_DRIVER" = "libvirt" ]; then
531 # Libvirt-LXC
532 if [ "$LIBVIRT_TYPE" = "lxc" ]; then
533 iniset $TEMPEST_CONFIG compute-feature-enabled rescue False
534 iniset $TEMPEST_CONFIG compute-feature-enabled resize False
535 iniset $TEMPEST_CONFIG compute-feature-enabled shelve False
536 iniset $TEMPEST_CONFIG compute-feature-enabled snapshot False
537 iniset $TEMPEST_CONFIG compute-feature-enabled suspend False
Matt Riedemanne9a9fbe2017-01-30 22:22:43 -0500538 elif ! is_service_enabled n-cell; then
539 # cells v1 does not support swapping volumes
540 iniset $TEMPEST_CONFIG compute-feature-enabled swap_volume True
Matt Riedemann92575ba2016-09-21 16:15:31 -0400541 fi
Nels Nelson7b47c472015-01-05 16:36:42 -0600542 fi
543
Dean Troyerdc97cb72015-03-28 08:20:50 -0500544 # ``service_available``
Sean Dague346edcc2015-08-26 09:38:37 -0400545 #
ghanshyamf0dd9992018-11-26 07:38:54 +0000546 # this tempest service list needs to be the services that
547 # tempest own, otherwise we can have an erroneous set of
Sean Dague346edcc2015-08-26 09:38:37 -0400548 # defaults (something defaulting true in Tempest, but not listed here).
ghanshyamf0dd9992018-11-26 07:38:54 +0000549 # services tested by tempest plugins needs to be set on service devstack
550 # plugin side as devstack cannot keep track of all the tempest plugins
551 # services. Refer Bug#1743688 for more details.
552 # 'horizon' is also kept here as no devtack plugin for horizon.
Sean Dague0f765352016-02-18 06:53:08 -0500553 local service
ghanshyamf0dd9992018-11-26 07:38:54 +0000554 local tempest_services="key,glance,nova,neutron,cinder,swift,horizon"
Sean Dague0f765352016-02-18 06:53:08 -0500555 for service in ${tempest_services//,/ }; do
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400556 if is_service_enabled $service ; then
john-griffithdc4dc7f2014-01-22 18:09:32 -0700557 iniset $TEMPEST_CONFIG service_available $service "True"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400558 else
john-griffithdc4dc7f2014-01-22 18:09:32 -0700559 iniset $TEMPEST_CONFIG service_available $service "False"
Matthew Treinishb56d81d2013-07-23 17:25:39 -0400560 fi
561 done
562
Matt Riedemanncf94edc2015-10-28 09:50:01 -0700563 if [ "$VIRT_DRIVER" = "libvirt" ] && [ "$LIBVIRT_TYPE" = "lxc" ]; then
564 # libvirt-lxc does not support boot from volume or attaching volumes
565 # so basically anything with cinder is out of the question.
566 iniset $TEMPEST_CONFIG service_available cinder "False"
567 fi
568
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400569 # Run tempest configuration utilities. This must be done last during configuration to
570 # ensure as complete a config as possible already exists
571
572 # NOTE(mtreinish): Respect constraints on tempest verify-config venv
573 local tmp_cfg_file
574 tmp_cfg_file=$(mktemp)
575 cd $TEMPEST_DIR
576 if [[ "$OFFLINE" != "True" ]]; then
Matthew Treinish440464c2016-05-04 11:55:12 -0400577 tox -revenv-tempest --notest
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400578 fi
Claudiu Belu34c16792017-06-12 09:32:21 -0700579
580 # The requirements might be on a different branch, while tempest needs master requirements.
Lenny Verkhovsky64652192018-08-29 16:41:04 +0300581 (cd $REQUIREMENTS_DIR && git show origin/master:upper-constraints.txt) > u-c-m.txt
Claudiu Belu34c16792017-06-12 09:32:21 -0700582 tox -evenv-tempest -- pip install -c u-c-m.txt -r requirements.txt
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400583
584 # Auth:
Felipe Monteiro3cdff782018-07-09 20:25:08 +0100585 iniset $TEMPEST_CONFIG auth tempest_roles "member"
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400586 if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
587 if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
Matthew Treinish440464c2016-05-04 11:55:12 -0400588 tox -evenv-tempest -- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400589 else
Matthew Treinish440464c2016-05-04 11:55:12 -0400590 tox -evenv-tempest -- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY etc/accounts.yaml
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400591 fi
592 iniset $TEMPEST_CONFIG auth use_dynamic_credentials False
593 iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
594 elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
595 iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
596
597 else
598 iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
599 fi
600
601 # API Extensions
602 # Run ``verify_tempest_config -ur`` to retrieve enabled extensions on API endpoints
603 # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
604 tox -evenv -- tempest verify-config -uro $tmp_cfg_file
Sean Dague7b229352016-08-09 13:29:11 -0400605
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400606 # Neutron API Extensions
Sean Dague894ccc92016-08-08 16:19:05 -0400607
608 # disable metering if we didn't enable the service
609 if ! is_service_enabled q-metering; then
610 DISABLE_NETWORK_API_EXTENSIONS+=", metering"
611 fi
612
Dima Kuznetsov787412c2017-08-28 09:09:38 +0300613 # disable l3_agent_scheduler if we didn't enable L3 agent
614 if ! is_service_enabled q-l3; then
615 DISABLE_NETWORK_API_EXTENSIONS+=", l3_agent_scheduler"
616 fi
617
Matthew Treinishe8f3f7a2016-04-11 12:52:39 -0400618 local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
619 if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
620 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
621 network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
622 # Remove disabled extensions
623 network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
624 fi
625 iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
626 # Swift API Extensions
627 local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
628 if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
629 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
630 object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
631 # Remove disabled extensions
632 object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
633 fi
634 iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
635 # Cinder API Extensions
636 local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
637 if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
638 # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
639 volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
640 # Remove disabled extensions
641 volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
642 fi
643 iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
644
Attila Fazekas2aa35172012-12-05 20:03:40 +0100645 # Restore IFS
646 IFS=$ifs
Sean Dagued0931212012-10-04 16:06:44 -0400647}
648
Sean Dagued0931212012-10-04 16:06:44 -0400649# install_tempest() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100650function install_tempest {
Sean Dagued0931212012-10-04 16:06:44 -0400651 git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
Anna Khmelnitsky730faa22017-09-01 16:25:09 -0700652 pip_install 'tox!=2.8.0'
Matthew Treinish83e166b2015-02-18 19:01:20 -0500653 pushd $TEMPEST_DIR
Sean Dague583c5202017-03-21 11:15:05 -0400654 tox -r --notest -efull
Matthew Treinish1e31e682016-02-09 23:50:54 -0500655 # NOTE(mtreinish) Respect constraints in the tempest full venv, things that
656 # are using a tox job other than full will not be respecting constraints but
657 # running pip install -U on tempest requirements
Matthew Treinish440464c2016-05-04 11:55:12 -0400658 $TEMPEST_DIR/.tox/tempest/bin/pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
659 PROJECT_VENV["tempest"]=${TEMPEST_DIR}/.tox/tempest
Matthew Treinish7e603d12016-06-01 18:16:14 -0400660 popd
661}
662
663# install_tempest_plugins() - Install any specified plugins into the tempest venv
664function install_tempest_plugins {
665 pushd $TEMPEST_DIR
Matthew Treinish440464c2016-05-04 11:55:12 -0400666 if [[ $TEMPEST_PLUGINS != 0 ]] ; then
Daniel Melladodc5d88b2018-04-12 11:41:59 -0400667 tox -evenv-tempest -- pip install -c $REQUIREMENTS_DIR/upper-constraints.txt $TEMPEST_PLUGINS
Matthew Treinishb6558672016-05-20 17:30:17 -0400668 echo "Checking installed Tempest plugins:"
669 tox -evenv-tempest -- tempest list-plugins
Matthew Treinishb31640a2016-05-02 16:33:29 -0400670 fi
Matthew Treinish83e166b2015-02-18 19:01:20 -0500671 popd
Sean Dagued0931212012-10-04 16:06:44 -0400672}
673
Sean Dagued0931212012-10-04 16:06:44 -0400674# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +1100675$_XTRACE_TEMPEST
Sean Dague584d90e2013-03-29 14:34:53 -0400676
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100677# Tell emacs to use shell-script-mode
678## Local variables:
679## mode: shell-script
680## End: