blob: 9605ace2bcf4512e1c5698c58df80c09d1f37d6e [file] [log] [blame]
Jesse Andrewsf6705492011-11-01 16:04:14 -07001#!/usr/bin/env bash
2
Jesse Andrews9f186342011-11-01 16:05:40 -07003# we will use the ``euca2ools`` cli tool that wraps the python boto
4# library to test ec2 compatibility
Jesse Andrewsf6705492011-11-01 16:04:14 -07005#
6
Jesse Andrewsf6705492011-11-01 16:04:14 -07007# This script exits on an error so that errors don't compound and you see
8# only the first error that occured.
9set -o errexit
10
11# Print the commands being run so that we can see the command that triggers
12# an error. It is also useful for following allowing as the install occurs.
13set -o xtrace
14
15
16# Settings
17# ========
18
19# Use openrc + stackrc + localrc for settings
Jesse Andrews787af012011-11-01 16:44:19 -070020pushd $(cd $(dirname "$0")/.. && pwd)
Jesse Andrewsf6705492011-11-01 16:04:14 -070021source ./openrc
Jesse Andrews787af012011-11-01 16:44:19 -070022popd
Jesse Andrewsf6705492011-11-01 16:04:14 -070023
Jesse Andrews9f186342011-11-01 16:05:40 -070024# find a machine image to boot
Jesse Andrewsf6705492011-11-01 16:04:14 -070025IMAGE=`euca-describe-images | grep machine | cut -f2`
26
Jesse Andrews9f186342011-11-01 16:05:40 -070027# launch it
Todd Willey9e9132d2011-11-04 12:09:54 -040028INSTANCE=`euca-run-instances $IMAGE | grep INSTANCE | cut -f2`
Jesse Andrewsf6705492011-11-01 16:04:14 -070029
Jesse Andrews9f186342011-11-01 16:05:40 -070030# assure it has booted within a reasonable time
Todd Willey9a3066f2011-11-05 11:02:34 -040031if ! timeout $RUNNING_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then
32 echo "server didn't become active within $RUNNING_TIMEOUT seconds"
Jesse Andrewsf6705492011-11-01 16:04:14 -070033 exit 1
34fi
35
36euca-terminate-instances $INSTANCE