Skip to content

Commit

Permalink
Bugfix integration tests
Browse files Browse the repository at this point in the history
Made a workaround for UH-IaaS having multiple images with the same name.
Fixed a bug in test_clones.sh.
  • Loading branch information
oyvindhagberg committed Apr 10, 2018
1 parent 9d12367 commit cb5d357
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 14 additions & 5 deletions rpm/run_tests_on_vms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cd $(dirname "$0")

# Create an array containing the available machine images
TMPFILE=$(mktemp)
openstack image list | grep active | cut -d '|' -f 3 > $TMPFILE
openstack image list | grep active | cut -d '|' -f 3 | sort -u > $TMPFILE
IFS=$'\r\n' GLOBIGNORE='*' command eval 'LIST=($(cat ${TMPFILE}))'
rm $TMPFILE

Expand Down Expand Up @@ -66,10 +66,19 @@ for IMAGE in "${IMAGES[@]}"; do
echo "Creating a VM with \"$IMAGE\""
NAME="voyager"
openstack server delete --wait $NAME 2>/dev/null # just to be sure
openstack server create --image "$IMAGE" --flavor m1.small \
--key-name $KEYPAIRNAME --nic net-id=dualStack --wait $NAME \
$SECGROUP \
> /dev/null

# UH-IaaS suddenly decided to keep more than 1 active image with the same name.
# That means we can't use the image name for the "create server"-command.
# This is a workaround.
ID=$(openstack image list | grep "$IMAGE" | grep active | head -1 | cut -d '|' -f 2 | xargs)
if [[ "$ID" == "" ]]; then
echo "Could find image ID for $IMAGE :-("
exit 1
fi
openstack server create --image "$ID" --flavor m1.small \
--key-name $KEYPAIRNAME --nic net-id=dualStack \
$SECGROUP --wait $NAME > /dev/null

IP=$(openstack server list | grep $NAME | \
grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
echo "IP address: \"$IP\""
Expand Down
1 change: 0 additions & 1 deletion tests/test_clones.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ if [[ ! -f /var/run/nivlheim_client_last_run ]]; then
echo "The client failed to post data successfully."
exit 1
fi
curl -sS 'http://localhost:4040/api/v0/triggerJob/handleDNSchangesJob'

# Copy the nonce
echo "Nonce = " $(sudo cat /var/nivlheim/nonce)
Expand Down

0 comments on commit cb5d357

Please sign in to comment.