tests-ansible-env-prep: Fix plugin, tests and ops testing on Vagrant

Our Vagrantfile is rsync'ing the role to /vagrant. This breaks the
role test since the $WORKING_DIR no longer matches the name of the
OSA project. As such, when we are using vagrant to test the plugins
tests and ops repositories we end up using the HEAD of the repositories
instead of our local copy. We fix this by introducing a new
OSA_PROJECT_NAME and then we test against this to determine the actual
OSA project we are testing

Change-Id: Ic8b99b4f2d241144e1200ddf7c33742e9bc91c5b
This commit is contained in:
Markos Chandras 2018-08-16 15:55:39 +01:00
parent a59bbd4379
commit 0aeb045fb0
2 changed files with 5 additions and 3 deletions

View File

@ -33,6 +33,7 @@ set -xeu
## Vars ----------------------------------------------------------------------
WORKING_DIR="$(readlink -f $(dirname $0))"
OSA_PROJECT_NAME="$(sed -n 's|^project=openstack/\(.*\).git$|\1|p' $(pwd)/.gitreview)"
COMMON_TESTS_PATH="${WORKING_DIR}/tests/common"
TESTING_HOME=${TESTING_HOME:-$HOME}
@ -69,7 +70,7 @@ which git &>/dev/null || eval sudo "${pkg_mgr_cmd}" git
if [[ ! -d "${COMMON_TESTS_PATH}" ]]; then
# The tests repo doesn't need a clone, we can just
# symlink it.
if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then
if [[ "${OSA_PROJECT_NAME}" == "openstack-ansible-tests" ]]; then
ln -s "${WORKING_DIR}" "${COMMON_TESTS_PATH}"
# In zuul v3 any dependent repository is placed into

View File

@ -32,6 +32,7 @@ set -e
export TESTING_HOME=${TESTING_HOME:-$HOME}
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
export ROLE_NAME=${ROLE_NAME:-''}
export OSA_PROJECT_NAME="$(sed -n 's|^project=openstack/\(.*\).git$|\1|p' $(pwd)/.gitreview)"
export ANSIBLE_INVENTORY=${ANSIBLE_INVENTORY:-$WORKING_DIR/tests/inventory}
export ANSIBLE_ROLE_REQUIREMENTS_PATH=${ANSIBLE_ROLE_REQUIREMENTS_PATH:-$WORKING_DIR/tests/ansible-role-requirements.yml}
export ANSIBLE_EXTRA_ROLE_DIRS=${ANSIBLE_EXTRA_ROLE_DIRS:-''}
@ -101,7 +102,7 @@ mkdir -p "${ANSIBLE_LOG_DIR}"
if [[ ! -d "${ANSIBLE_PLUGIN_DIR}" ]]; then
# The plugins repo doesn't need a clone, we can just
# symlink it.
if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-plugins" ]]; then
if [[ "${OSA_PROJECT_NAME}" == "openstack-ansible-plugins" ]]; then
ln -s ${WORKING_DIR} "${ANSIBLE_PLUGIN_DIR}"
else
git clone \
@ -113,7 +114,7 @@ fi
if [[ ! -d "${OSA_OPS_DIR}" ]]; then
# The ops repo doesn't need a clone, we can just
# symlink it.
if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-ops" ]]; then
if [[ "${OSA_PROJECT_DIR}" == "openstack-ansible-ops" ]]; then
ln -s ${WORKING_DIR} "${OSA_OPS_DIR}"
else
git clone \