120 lines
5.8 KiB
Bash
Executable File
120 lines
5.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright 2013 Red Hat
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
set -eux
|
|
set -o pipefail
|
|
|
|
# Setup the environment
|
|
TEMPEST_RUN_CONCURRENCY=${TEMPEST_RUN_CONCURRENCY:-0}
|
|
TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-true}
|
|
TEMPEST_IMAGE_NAME=${TEMPEST_IMAGE_NAME:-user}
|
|
|
|
cd /opt/stack/tempest
|
|
|
|
# Tempest needs 2 users, we add them here so that we know their passwords
|
|
keystone tenant-get demo_t1 || keystone tenant-create --name demo_t1
|
|
keystone user-get demo_t1 || keystone user-create --name demo_t1 --tenant demo_t1 --pass secret
|
|
keystone tenant-get demo_t2 || keystone tenant-create --name demo_t2
|
|
keystone user-get demo_t2 || keystone user-create --name demo_t2 --tenant demo_t2 --pass secret
|
|
|
|
# the orchestration tests need this
|
|
keystone user-role-add --user admin --role admin --tenant demo_t1 || true
|
|
|
|
# Users need either this or the admin role to use swift
|
|
keystone user-role-add --user demo_t1 --role _member_ --tenant demo_t1 || true
|
|
keystone user-role-add --user demo_t2 --role _member_ --tenant demo_t2 || true
|
|
|
|
# We require that a image is present
|
|
USER_IMAGE=$(glance image-show $TEMPEST_IMAGE_NAME)
|
|
USER_IMAGE_ID=$(echo "$USER_IMAGE" | awk '$2=="id" {print $4}')
|
|
USER_IMAGE_DISK_FORMAT=$(echo "$USER_IMAGE" | awk '$2=="disk_format" {print $4}')
|
|
USER_IMAGE_CONTAINER_FORMAT=$(echo "$USER_IMAGE" | awk '$2=="container_format" {print $4}')
|
|
|
|
# And then copy it for tempest test that require a second image
|
|
if ! nova image-show ${TEMPEST_IMAGE_NAME}-copy 2> /dev/null ; then
|
|
glance image-download ${TEMPEST_IMAGE_NAME} | glance image-create --name ${TEMPEST_IMAGE_NAME}-copy \
|
|
--disk-format $USER_IMAGE_DISK_FORMAT --container-format $USER_IMAGE_CONTAINER_FORMAT --is-public 1
|
|
fi
|
|
|
|
USER_IMAGE_ID2=$(nova image-show ${TEMPEST_IMAGE_NAME}-copy | grep id | awk '$2=="id" {print $4}')
|
|
|
|
EXTNET=$(neutron net-show ext-net | awk '/ id / {print $4}')
|
|
|
|
# tempest requires two distinct flavors to use, but using m1.small would
|
|
# increase the amount of memory needed on the compute node. Instead we create
|
|
# an alternative m1.tiny, this will allow tests with only 4G of memory on
|
|
# compute nodes.
|
|
nova flavor-create m1.tiny_alt 99 512 2 1 || true
|
|
|
|
LOCK_PATH=`mktemp -d`
|
|
trap "rm -rf $LOCK_PATH" EXIT
|
|
|
|
# Calculate the keystone v3 from the v2 one
|
|
# Assuming the AUTH_URL is http://ip:port/version
|
|
OS_V3_AUTH_URL=${OS_AUTH_URL%/*}/v3
|
|
|
|
# TODO : see what other defaults can be used
|
|
# cp the tempest config file and edit the settings
|
|
cp etc/tempest.conf.sample etc/tempest.conf
|
|
cat - <<EOF | augtool --noautoload
|
|
set /augeas/load/PythonPaste/lens "PythonPaste.lns"
|
|
set /augeas/load/PythonPaste/incl "/opt/stack/tempest/etc/tempest.conf"
|
|
load
|
|
|
|
set /files/opt/stack/tempest/etc/tempest.conf/DEFAULT/lock_path $LOCK_PATH
|
|
set /files/opt/stack/tempest/etc/tempest.conf/DEFAULT/debug true
|
|
set /files/opt/stack/tempest/etc/tempest.conf/DEFAULT/use_stderr false
|
|
set /files/opt/stack/tempest/etc/tempest.conf/DEFAULT/log_file tempest.log
|
|
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/uri $OS_AUTH_URL
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/uri_v3 $OS_V3_AUTH_URL
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/region regionOne
|
|
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/admin_username $OS_USERNAME
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/admin_tenant_name $OS_TENANT_NAME
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/admin_password $OS_PASSWORD
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/username demo_t1
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/tenant_name demo_t1
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/password secret
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/alt_username demo_t2
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/alt_password secret
|
|
set /files/opt/stack/tempest/etc/tempest.conf/identity/alt_tenant_name demo_t2
|
|
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute/image_ref $USER_IMAGE_ID
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute/image_ref_alt $USER_IMAGE_ID2
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute/flavor_ref_alt 99
|
|
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute/allow_tenant_isolation $TEMPEST_ALLOW_TENANT_ISOLATION
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute/fixed_network_name default-net
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute/network_for_ssh $EXTNET
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute-admin/password $OS_PASSWORD
|
|
set /files/opt/stack/tempest/etc/tempest.conf/compute-feature-enabled/resize false
|
|
set /files/opt/stack/tempest/etc/tempest.conf/network/public_network_id $EXTNET
|
|
set /files/opt/stack/tempest/etc/tempest.conf/service_available/cinder false
|
|
set /files/opt/stack/tempest/etc/tempest.conf/service_available/heat true
|
|
set /files/opt/stack/tempest/etc/tempest.conf/service_available/neutron true
|
|
set /files/opt/stack/tempest/etc/tempest.conf/service_available/ceilometer false
|
|
set /files/opt/stack/tempest/etc/tempest.conf/service_available/horizon false
|
|
set /files/opt/stack/tempest/etc/tempest.conf/stress/max_instances 4
|
|
set /files/opt/stack/tempest/etc/tempest.conf/stress/default_thread_number_per_action 2
|
|
set /files/opt/stack/tempest/etc/tempest.conf/network/tenant_network_cidr 172.16.0.0/16
|
|
|
|
save
|
|
EOF
|
|
|
|
testr run --parallel --concurrency ${TEMPEST_RUN_CONCURRENCY} $(python tests2skip.py tests2skip.txt)
|