summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcristinapauna <cristina.pauna@enea.com>2016-09-05 18:47:23 +0300
committerwenjuan dong <dong.wenjuan@zte.com.cn>2016-09-09 00:07:11 +0000
commitbf0297632480f0c97d94cddd963854bdaf2aa852 (patch)
tree45fc8c0614764abb3dbe189fa5ad81d1ede26e6d
parentfb3fe95e53c67fb7aa647bff4622dcd8be0619c2 (diff)
Run the tests with existing image
When ran in functest on arm, the doctor suite fails because the x86 image is hardocded in the source files. This change adds the option to run the doctor suite with an existing image as opposed to downloading and creating it. The image name is taken from an enviroment variables (if it is set). When ran with functest, the env variable is set in doctor.py file. Change-Id: Ib6ce56e650ebe8b29618a9a31ec990f9f0895f54 Signed-off-by: cristinapauna <cristina.pauna@enea.com> (cherry picked from commit 34e593954e048a86c90dd851de6a84c7329a937b)
-rwxr-xr-xtests/run.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/run.sh b/tests/run.sh
index 2b251690..99e8feff 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -11,7 +11,8 @@
[[ "${CI_DEBUG:-true}" == [Tt]rue ]] && set -x
IMAGE_URL=https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
-IMAGE_NAME=cirros
+#if an existing image name is provided in the enviroment, use that one
+IMAGE_NAME=${IMAGE_NAME:-cirros}
IMAGE_FILE="${IMAGE_NAME}.img"
IMAGE_FORMAT=qcow2
VM_NAME=doctor_vm1
@@ -252,8 +253,14 @@ get_consumer_ip() {
}
download_image() {
- [ -e "$IMAGE_FILE" ] && return 0
- wget "$IMAGE_URL" -o "$IMAGE_FILE"
+ #if a different name was provided for the image in the enviroment there's no need to download the image
+ use_existing_image=false
+ openstack image list | grep -q " $IMAGE_NAME " && use_existing_image=true
+
+ if [[ "$use_existing_image" == false ]] ; then
+ [ -e "$IMAGE_FILE" ] && return 0
+ wget "$IMAGE_URL" -o "$IMAGE_FILE"
+ fi
}
register_image() {
@@ -536,7 +543,10 @@ cleanup() {
image_id=$(openstack image list | grep " $IMAGE_NAME " | awk '{print $2}')
sleep 1
- [ -n "$image_id" ] && openstack image delete "$image_id"
+ #if an existing image was used, there's no need to remove it here
+ if [[ "$use_existing_image" == false ]] ; then
+ [ -n "$image_id" ] && openstack image delete "$image_id"
+ fi
openstack role remove "$DOCTOR_ROLE" --user "$DOCTOR_USER" \
--project "$DOCTOR_PROJECT"
openstack project delete "$DOCTOR_PROJECT"