Wrap exercises with master script, with logs, and move common variables.

This commit is contained in:
Todd Willey 2011-11-04 10:31:37 -04:00
parent 787af01bdd
commit 2599b3165a
4 changed files with 32 additions and 12 deletions

24
exercise.sh Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Run everything in the exercises/ directory that isn't explicitly disabled
# comma separated list of script basenames to skip
# to refrain from exercising euca.sh use SKIP_EXERCISES=euca
SKIP_EXERCISES=${SKIP_EXERCISES:-""}
EXERCISE_DIR=$(dirname "$0")/exercises
basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done)
for script in $basenames ; do
if [[ "$SKIP_EXERCISES" =~ $script ]] ; then
echo SKIPPING $script
else
echo Running $script
$EXERCISE_DIR/$script.sh 2> $script.log
if [[ $? -ne 0 ]] ; then
echo FAILED. See $script.log
else
rm $script.log
fi
fi
done

View File

@ -21,9 +21,6 @@ pushd $(cd $(dirname "$0")/.. && pwd)
source ./openrc
popd
# Max time till the vm is bootable
BOOT_TIMEOUT=${BOOT_TIMEOUT:-15}
# find a machine image to boot
IMAGE=`euca-describe-images | grep machine | cut -f2`

View File

@ -84,15 +84,6 @@ nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP
# Waiting for boot
# ----------------
# Max time to wait while vm goes from build to active state
ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10}
# Max time till the vm is bootable
BOOT_TIMEOUT=${BOOT_TIMEOUT:-15}
# Max time to wait for proper association and dis-association.
ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10}
# check that the status is active within ACTIVE_TIMEOUT seconds
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $NAME | grep status | grep -q ACTIVE; do sleep 1; done"; then
echo "server didn't become active!"

8
openrc
View File

@ -49,3 +49,11 @@ export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete}
# set log level to DEBUG (helps debug issues)
# export NOVACLIENT_DEBUG=1
# Max time till the vm is bootable
export BOOT_TIMEOUT=${BOOT_TIMEOUT:-15}
# Max time to wait while vm goes from build to active state
export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10}
# Max time to wait for proper IP association and dis-association.
export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10}