From 02b4b4c43fbed744ba375f62ffc5d323e363cfb6 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Fri, 12 Feb 2016 11:24:52 -0500 Subject: [PATCH] Add test option to use Ansible source repo This restores the ability to run the Ansible tests using Ansible from the source repo rather than the production version from pip. Using production will be the default, but this sets us up to add a new job to test against the latest dev version, if we want. Change-Id: I93cdec653dd672acfbc03576d100d19ab8595f2e --- extras/run-ansible-tests.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/extras/run-ansible-tests.sh b/extras/run-ansible-tests.sh index d9bf662be..146f5436b 100755 --- a/extras/run-ansible-tests.sh +++ b/extras/run-ansible-tests.sh @@ -8,11 +8,14 @@ # tox -e ansible [TAG ...] # or # tox -e ansible -- -c cloudX [TAG ...] +# or to use the development version of Ansible: +# tox -e ansible -- -d -c cloudX [TAG ...] # # USAGE: -# run-ansible-tests.sh -e ENVDIR [-c CLOUD] [TAG ...] +# run-ansible-tests.sh -e ENVDIR [-d] [-c CLOUD] [TAG ...] # # PARAMETERS: +# -d Use Ansible source repo development branch. # -e ENVDIR Directory of the tox environment to use for testing. # -c CLOUD Name of the cloud to use for testing. # Defaults to "devstack-admin". @@ -30,10 +33,12 @@ CLOUD="devstack-admin" ENVDIR= +USE_DEV=0 -while getopts "c:e:" opt +while getopts "c:de:" opt do case $opt in + d) USE_DEV=1 ;; c) CLOUD=${OPTARG} ;; e) ENVDIR=${OPTARG} ;; ?) echo "Invalid option: -${OPTARG}" @@ -54,8 +59,20 @@ TAGS=$( echo "$*" | tr ' ' , ) # be setup for the correct python environment. source $ENVDIR/bin/activate -echo "Installing Ansible" -pip install ansible +if [ ${USE_DEV} -eq 1 ] +then + if [ -d ${ENVDIR}/ansible ] + then + echo "Using existing Ansible source repo" + else + echo "Installing Ansible source repo at $ENVDIR" + git clone --recursive git://github.com/ansible/ansible.git ${ENVDIR}/ansible + fi + source $ENVDIR/ansible/hacking/env-setup +else + echo "Installing Ansible from pip" + pip install ansible +fi # Run the shade Ansible tests tag_opt=""