Update devstack's Tempest integration

Split build_ci_config.sh into:
* tools/build_tempest.sh - checks out Tempest and installs prereqs
* tools/configure_tempest.sh - creates tempest.conf from devstack

Change-Id: I22f40226afb617a5a6e32f2631b07d5509f10b13
This commit is contained in:
Dean Troyer 2012-01-10 14:43:17 -06:00
parent ce05e03213
commit 608bb12ae5
4 changed files with 124 additions and 74 deletions

View File

@ -42,9 +42,9 @@ QUANTUM_BRANCH=master
QUANTUM_CLIENT_REPO=https://github.com/openstack/python-quantumclient
QUANTUM_CLIENT_BRANCH=master
# CI test suite
CITEST_REPO=https://github.com/openstack/tempest.git
CITEST_BRANCH=master
# Tempest test suite
TEMPEST_REPO=https://github.com/openstack/tempest.git
TEMPEST_BRANCH=master
# Specify a comma-separated list of uec images to download and install into glance.
# supported urls here are:

85
tools/build_tempest.sh Executable file
View File

@ -0,0 +1,85 @@
#!/usr/bin/env bash
#
# build_tempest.sh - Checkout and prepare a Tempest repo
# (https://github.com/openstack/tempest.git)
function usage {
echo "$0 - Check out and prepare a Tempest repo"
echo ""
echo "Usage: $0"
exit 1
}
if [ "$1" = "-h" ]; then
usage
fi
# Clean up any resources that may be in use
cleanup() {
set +o errexit
# Kill ourselves to signal any calling process
trap 2; kill -2 $$
}
trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
# Keep track of the current directory
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=`cd $TOOLS_DIR/..; pwd`
# Abort if localrc is not set
if [ ! -e $TOP_DIR/localrc ]; then
echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding."
echo "See stack.sh for required passwords."
exit 1
fi
# Source params
source ./stackrc
# Where Openstack code lives
DEST=${DEST:-/opt/stack}
TEMPEST_DIR=$DEST/tempest
DIST_NAME=${DIST_NAME:-oneiric}
# git clone only if directory doesn't exist already. Since ``DEST`` might not
# be owned by the installation user, we create the directory and change the
# ownership to the proper user.
function git_clone {
GIT_REMOTE=$1
GIT_DEST=$2
GIT_BRANCH=$3
# do a full clone only if the directory doesn't exist
if [ ! -d $GIT_DEST ]; then
git clone $GIT_REMOTE $GIT_DEST
cd $2
# This checkout syntax works for both branches and tags
git checkout $GIT_BRANCH
elif [[ "$RECLONE" == "yes" ]]; then
# if it does exist then simulate what clone does if asked to RECLONE
cd $GIT_DEST
# set the url to pull from and fetch
git remote set-url origin $GIT_REMOTE
git fetch origin
# remove the existing ignored files (like pyc) as they cause breakage
# (due to the py files having older timestamps than our pyc, so python
# thinks the pyc files are correct using them)
find $GIT_DEST -name '*.pyc' -delete
git checkout -f origin/$GIT_BRANCH
# a local branch might not exist
git branch -D $GIT_BRANCH || true
git checkout -b $GIT_BRANCH
fi
}
# Install tests and prerequisites
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $TOP_DIR/files/pips/tempest`
git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH
trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT

View File

@ -149,7 +149,7 @@ git_clone $NOVNC_REPO $DEST/novnc $NOVNC_BRANCH
git_clone $HORIZON_REPO $DEST/horizon $HORIZON_BRANCH
git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH
git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH
git_clone $CITEST_REPO $DEST/tempest $CITEST_BRANCH
git_clone $TEMPEST_REPO $DEST/tempest $TEMPEST_BRANCH
# Use this version of devstack
rm -rf $MNT_DIR/$DEST/devstack

View File

@ -1,10 +1,9 @@
#!/usr/bin/env bash
#
# build_ci_config.sh - Build a config.ini for tempest (openstack-integration-tests)
# (https://github.com/openstack/tempest.git)
# configure_tempest.sh - Build a tempest configuration file from devstack
function usage {
echo "$0 - Build config.ini for tempest"
echo "$0 - Build tempest.conf"
echo ""
echo "Usage: $0 [configdir]"
exit 1
@ -19,9 +18,6 @@ cleanup() {
set +o errexit
# Mop up temporary files
if [ -n "$CONFIG_CONF_TMP" -a -e "$CONFIG_CONF_TMP" ]; then
rm -f $CONFIG_CONF_TMP
fi
if [ -n "$CONFIG_INI_TMP" -a -e "$CONFIG_INI_TMP" ]; then
rm -f $CONFIG_INI_TMP
fi
@ -46,53 +42,21 @@ fi
# Source params
source ./stackrc
# Set defaults not configured by stackrc
TENANT=${TENANT:-admin}
USERNAME=${USERNAME:-admin}
IDENTITY_HOST=${IDENTITY_HOST:-$HOST_IP}
IDENTITY_PORT=${IDENTITY_PORT:-5000}
IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
# Where Openstack code lives
DEST=${DEST:-/opt/stack}
CITEST_DIR=$DEST/tempest
TEMPEST_DIR=$DEST/tempest
CONFIG_DIR=${1:-$CITEST_DIR/etc}
CONFIG_CONF=$CONFIG_DIR/storm.conf
CONFIG_DIR=${1:-$TEMPEST_DIR/etc}
CONFIG_INI=$CONFIG_DIR/config.ini
DIST_NAME=${DIST_NAME:-oneiric}
# git clone only if directory doesn't exist already. Since ``DEST`` might not
# be owned by the installation user, we create the directory and change the
# ownership to the proper user.
function git_clone {
GIT_REMOTE=$1
GIT_DEST=$2
GIT_BRANCH=$3
# do a full clone only if the directory doesn't exist
if [ ! -d $GIT_DEST ]; then
git clone $GIT_REMOTE $GIT_DEST
cd $2
# This checkout syntax works for both branches and tags
git checkout $GIT_BRANCH
elif [[ "$RECLONE" == "yes" ]]; then
# if it does exist then simulate what clone does if asked to RECLONE
cd $GIT_DEST
# set the url to pull from and fetch
git remote set-url origin $GIT_REMOTE
git fetch origin
# remove the existing ignored files (like pyc) as they cause breakage
# (due to the py files having older timestamps than our pyc, so python
# thinks the pyc files are correct using them)
find $GIT_DEST -name '*.pyc' -delete
git checkout -f origin/$GIT_BRANCH
# a local branch might not exist
git branch -D $GIT_BRANCH || true
git checkout -b $GIT_BRANCH
fi
}
# Install tests and prerequisites
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $TOP_DIR/files/pips/tempest`
git_clone $CITEST_REPO $CITEST_DIR $CITEST_BRANCH
TEMPEST_CONF=$CONFIG_DIR/tempest.conf
if [ ! -f $DEST/.ramdisk ]; then
# Process network configuration vars
@ -127,6 +91,7 @@ GLANCE_PORT=$2
# Defaults to use first image
IMAGE_DIR=""
IMAGE_NAME=""
for imagedir in $TOP_DIR/files/images/*; do
KERNEL=""
RAMDISK=""
@ -146,34 +111,34 @@ for imagedir in $TOP_DIR/files/images/*; do
# Save the first image directory that contains a disk image link
if [ -z "$IMAGE_DIR" ]; then
IMAGE_DIR=$imagedir
IMAGE_NAME=$(basename ${IMAGE%.img})
fi
fi
done
if [[ -n "$IMAGE_NAME" ]]; then
# Get the image UUID
IMAGE_UUID=$(nova image-list | grep " $IMAGE_NAME " | cut -d'|' -f2)
# Strip spaces off
IMAGE_UUID=$(echo $IMAGE_UUID)
fi
# Create storm.conf
# Create tempest.conf from tempest.conf.sample
CONFIG_CONF_TMP=$(mktemp $CONFIG_CONF.XXXXXX)
cat >$CONFIG_CONF_TMP <<EOF
[nova]
auth_url=http://$HOST_IP:5000/v2.0/tokens
user=admin
api_key=$ADMIN_PASSWORD
tenant_name=admin
ssh_timeout=300
build_interval=10
build_timeout=600
if [[ ! -r $TEMPEST_CONF ]]; then
cp $TEMPEST_CONF.sample $TEMPEST_CONF
fi
[environment]
image_ref=3
image_ref_alt=4
flavor_ref=1
flavor_ref_alt=2
create_image_enabled=true
resize_available=true
authentication=keystone_v2
EOF
mv $CONFIG_CONF_TMP $CONFIG_CONF
CONFIG_CONF_TMP=""
sed -e "
/^api_key=/s|=.*\$|=$ADMIN_PASSWORD|;
/^auth_url=/s|=.*\$|=${OS_AUTH_URL%/}/tokens/|;
/^host=/s|=.*\$|=$HOST_IP|;
/^image_ref=/s|=.*\$|=$IMAGE_UUID|;
/^password=/s|=.*\$|=$ADMIN_PASSWORD|;
/^tenant=/s|=.*\$|=$TENANT|;
/^tenant_name=/s|=.*\$|=$TENANT|;
/^user=/s|=.*\$|=$USERNAME|;
/^username=/s|=.*\$|=$USERNAME|;
" -i $TEMPEST_CONF
# Create config.ini