From c384424e94f7d4a84670630860bf1848a0563342 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 30 Dec 2011 14:27:02 -0600 Subject: [PATCH] exercises/euca.sh timing fixes Adjust timing in the script for testing on slower systems, such as VMs on laptops. Change-Id: I657fe54c7a4b75169b84ae1af37c88e2941e918a --- exercises/euca.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/exercises/euca.sh b/exercises/euca.sh index 67150e4422..dc2d9cac79 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -33,7 +33,7 @@ euca-add-group -d description $SECGROUP INSTANCE=`euca-run-instances -g $SECGROUP -t m1.tiny $IMAGE | grep INSTANCE | cut -f2` # Assure it has booted within a reasonable time -if ! timeout $RUNNING_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then +if ! timeout $RUNNING_TIMEOUT sh -c "while ! euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then echo "server didn't become active within $RUNNING_TIMEOUT seconds" exit 1 fi @@ -48,10 +48,10 @@ euca-associate-address -i $INSTANCE $FLOATING_IP # Authorize pinging euca-authorize -P icmp -s 0.0.0.0/0 -t -1:-1 $SECGROUP -# Max time till the vm is bootable -BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} -if ! timeout $BOOT_TIMEOUT sh -c "while ! ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then - echo "Couldn't ping server" +# Test we can ping our floating ip within ASSOCIATE_TIMEOUT seconds +ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10} +if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then + echo "Couldn't ping server with floating ip" exit 1 fi @@ -67,5 +67,11 @@ euca-disassociate-address $FLOATING_IP # Release floating address euca-release-address $FLOATING_IP +# Wait just a tick for everything above to complete so terminate doesn't fail +if ! timeout $ASSOCIATE_TIMEOUT sh -c "while euca-describe-addresses | grep -q $FLOATING_IP; do sleep 1; done"; then + echo "Floating ip $FLOATING_IP not released within $ASSOCIATE_TIMEOUT seconds" + exit 1 +fi + # Terminate instance euca-terminate-instances $INSTANCE