diff --git a/stackrc b/stackrc index ce349716dc..acc5ac0617 100644 --- a/stackrc +++ b/stackrc @@ -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: diff --git a/tools/build_tempest.sh b/tools/build_tempest.sh new file mode 100755 index 0000000000..aa44766ae8 --- /dev/null +++ b/tools/build_tempest.sh @@ -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 diff --git a/tools/build_uec_ramdisk.sh b/tools/build_uec_ramdisk.sh index 3bd704ba9c..174eaac72c 100755 --- a/tools/build_uec_ramdisk.sh +++ b/tools/build_uec_ramdisk.sh @@ -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 diff --git a/tools/build_ci_config.sh b/tools/configure_tempest.sh similarity index 65% rename from tools/build_ci_config.sh rename to tools/configure_tempest.sh index 79f6ead0e5..00add9a336 100755 --- a/tools/build_ci_config.sh +++ b/tools/configure_tempest.sh @@ -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 <