summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-06-08 11:10:13 (GMT)
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2015-06-08 11:10:13 (GMT)
commitff6c357349c5763d82b75d6b4b4e3a6a463fa954 (patch)
tree41963557296cd3e7431f5acebb485465748c608c
parent8b8def766a57ac86a818f1e045d106cd8af60296 (diff)
downloaddefinitions-baserock/franred/config-tempest-kilo.tar.gz
WIP: clean set openstack_to_run_tempestbaserock/franred/config-tempest-kilo
Change-Id: Ia06331f3cd2c95f7e339e1ed557f495c9b895cc0
-rwxr-xr-xopenstack/etc/tempest/set_openstack_to_run_tempest.sh51
1 files changed, 34 insertions, 17 deletions
diff --git a/openstack/etc/tempest/set_openstack_to_run_tempest.sh b/openstack/etc/tempest/set_openstack_to_run_tempest.sh
index 5270424..aa568cb 100755
--- a/openstack/etc/tempest/set_openstack_to_run_tempest.sh
+++ b/openstack/etc/tempest/set_openstack_to_run_tempest.sh
@@ -13,29 +13,45 @@
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# This script creates an public image in the admin tenant and
+# sets tempest.conf variables for running tests with images involved.
+# This is the minimal configuration to run tests for compute (api and services
+# tests).
+#
+# NOTE: the test image will be the following cirros image:
+# http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img
+#
-set -ex
+set -e
+# Global variables
admin_filename="admin_env"
+admin_test_image="cirros64_img_ref"
+image_ref=""
+
+# Openstack admin credentials
+admin_username="admin"
+admin_password="veryinsecure"
+admin_tenant="admin"
-create_admin_user_env(){
# Create a file with the environment variables
# required for setting a Openstack admin user in the
# admin tenant.
+create_admin_user_env(){
cat > "$admin_filename" <<EOF
- export OS_USERNAME=admin
- export OS_PASSWORD=veryinsecure
- export OS_TENANT_NAME=admin
+ export OS_USERNAME="$admin_username"
+ export OS_PASSWORD="$admin_password"
+ export OS_TENANT_NAME="$admin_tenant"
export OS_AUTH_URL=http://$(hostname):35357/v2.0
EOF
}
+# Set the image fields in tempest.conf with the UUID of the admin_test_image.
configure_image_ref(){
-# Set the image_ref field in tempest.conf with the UUID of the cirros64_img_ref
-# image.
- image_ref="$(glance image-list | grep 'cirros64_img_ref' | tr -d [:space:] | cut -d'|' -f 2)"
+ image_ref="$(glance image-list | grep "$admin_test_image" | tr -d [:space:] | cut -d'|' -f 2)"
if [ -z "image_ref" ]; then
- echo "ERROR: image_ref is empty, please check that cirros64_img_ref is created"
+ echo "ERROR: image_ref is empty, please check that $admin_test_image is in the image list."
exit 1
fi
# Configure the UUID (image_ref) for the created image
@@ -51,23 +67,24 @@ configure_image_ref(){
}
create_image_for_user(){
-# Create a image in the tenant $user called cirros64_img_ref
+# Create a image in the tenant $user called
local user_name="$1"
+ local test_image="$2"
# Set the credential for $user
source "${user_name}_env"
- # Delete images called cirros64_img_ref previously created
- if [ $(glance image-list | grep 'cirros64_img_ref' | wc -l) -gt 0 ]; then
- declare -a previous_img=$(glance image-list | grep 'cirros64_img_ref' | awk -F "|" '{ print $2 }')
+ # If there is an image with the same name as $test image, remove it.
+ if [ $(glance image-list | grep "$test_image" | wc -l) -gt 0 ]; then
+ declare -a previous_img=$(glance image-list | grep "$test_image" | awk -F "|" '{ print $2 }')
for index in ${previous_img[@]}; do
glance image-delete "$index"
done
fi
- glance image-create --name cirros64_img_ref \
+ glance image-create --name "$test_image" \
--location http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img \
--is-public true --disk-format qcow2 --container-format bare --progress
if [[ $? -eq 0 ]] \
- || [[ "$(glance image-list | grep 'cirros64_img_ref' | wc -l)" == "1" ]]; then
+ || [[ "$(glance image-list | grep "$test_image" | wc -l)" == "1" ]]; then
configure_image_ref
else
echo "ERROR: glance image-create failed."
@@ -75,6 +92,6 @@ create_image_for_user(){
fi
}
-image_ref=""
+# Configure Openstack for running tempest tests.
create_admin_user_env
-create_image_for_user "admin"
+create_image_for_user "$admin_username" "$admin_test_image"