Updated from OpenStack Ansible Tests
Change-Id: I90d955ef6407e44737f68d5d7b932f0ddb64316f
This commit is contained in:
parent
2e86cbd4d4
commit
fcd755320b
1
.gitignore
vendored
1
.gitignore
vendored
@ -69,3 +69,4 @@ tests/*.retry
|
||||
|
||||
# Git clones
|
||||
openstack-ansible-ops
|
||||
previous
|
||||
|
73
run_tests.sh
73
run_tests.sh
@ -12,8 +12,14 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Note:
|
||||
|
||||
# PURPOSE:
|
||||
# This script clones the openstack-ansible-tests repository to the
|
||||
# tests/common folder in order to be able to re-use test components
|
||||
# for role testing. This is intended to be the thinnest possible
|
||||
# shim for test execution outside of OpenStack CI.
|
||||
|
||||
# WARNING:
|
||||
# This file is maintained in the openstack-ansible-tests repository.
|
||||
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/run_tests.sh
|
||||
# If you need to modify this file, update the one in the openstack-ansible-tests
|
||||
@ -26,33 +32,60 @@ set -xeu
|
||||
|
||||
## Vars ----------------------------------------------------------------------
|
||||
|
||||
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
|
||||
WORKING_DIR="$(readlink -f $(dirname $0))"
|
||||
|
||||
COMMON_TESTS_PATH="${WORKING_DIR}/tests/common"
|
||||
TESTING_HOME=${TESTING_HOME:-$HOME}
|
||||
ZUUL_TESTS_CLONE_LOCATION="/home/zuul/src/git.openstack.org/openstack/openstack-ansible-tests"
|
||||
|
||||
# Use .gitreview as the key to determine the appropriate
|
||||
# branch to clone for tests.
|
||||
TESTING_BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' "${WORKING_DIR}/.gitreview")
|
||||
if [[ "${TESTING_BRANCH}" == "" ]]; then
|
||||
TESTING_BRANCH="master"
|
||||
fi
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
|
||||
# Source distribution information
|
||||
source /etc/os-release || source /usr/lib/os-release
|
||||
|
||||
install_pkg_deps() {
|
||||
pkg_deps="git"
|
||||
# Prefer dnf over yum for CentOS.
|
||||
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||
|
||||
# Prefer dnf over yum for CentOS.
|
||||
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||
# Figure out the appropriate package install command
|
||||
case ${ID,,} in
|
||||
*suse*) pkg_mgr_cmd="zypper -n in" ;;
|
||||
centos|rhel|fedora) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
|
||||
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
|
||||
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
case ${ID,,} in
|
||||
*suse*) pkg_mgr_cmd="zypper -n in" ;;
|
||||
centos|rhel|fedora) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
|
||||
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
|
||||
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
eval sudo $pkg_mgr_cmd $pkg_deps
|
||||
}
|
||||
|
||||
# Install the host distro package dependencies
|
||||
install_pkg_deps
|
||||
# Install git so that we can clone the tests repo
|
||||
eval sudo $pkg_mgr_cmd git
|
||||
|
||||
# Clone the tests repo for access to the common test script
|
||||
source tests/tests-repo-clone.sh
|
||||
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
|
||||
ln -s ${WORKING_DIR} ${COMMON_TESTS_PATH}
|
||||
|
||||
# In zuul v3 any dependent repository is placed into
|
||||
# /home/zuul/src/git.openstack.org, so we check to see
|
||||
# if there is a tests checkout there already. If so, we
|
||||
# symlink that and use it.
|
||||
elif [[ -d "${ZUUL_TESTS_CLONE_LOCATION}" ]]; then
|
||||
ln -s "${ZUUL_TESTS_CLONE_LOCATION}" ${COMMON_TESTS_PATH}
|
||||
|
||||
# Otherwise we're clearly not in zuul or using a previously setup
|
||||
# repo in some way, so just clone it from upstream.
|
||||
else
|
||||
git clone -b ${TESTING_BRANCH} \
|
||||
https://git.openstack.org/openstack/openstack-ansible-tests \
|
||||
${COMMON_TESTS_PATH}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute the common test script
|
||||
source tests/common/run_tests_common.sh
|
||||
|
@ -16,8 +16,14 @@
|
||||
check:
|
||||
jobs:
|
||||
- openstack-ansible-linters
|
||||
- openstack-ansible-functional-centos-7
|
||||
- openstack-ansible-functional-opensuse-423
|
||||
# TODO(odyssey4me):
|
||||
# Restore this to voting once the blocking
|
||||
# issue has been resolved.
|
||||
- openstack-ansible-functional-centos-7-nv
|
||||
# TODO(odyssey4me):
|
||||
# Restore this to voting once the blocking
|
||||
# issue has been resolved.
|
||||
- openstack-ansible-functional-opensuse-423-nv
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
- openstack-ansible-upgrade-ubuntu-xenial
|
||||
- openstack-ansible-ovs-ubuntu-xenial-nv
|
||||
@ -34,7 +40,13 @@
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-ansible-linters
|
||||
- openstack-ansible-functional-centos-7
|
||||
- openstack-ansible-functional-opensuse-423
|
||||
# TODO(odyssey4me):
|
||||
# Restore this once the blocking issue has
|
||||
# been resolved.
|
||||
#- openstack-ansible-functional-centos-7
|
||||
# TODO(odyssey4me):
|
||||
# Restore this once the blocking issue has
|
||||
# been resolved.
|
||||
#- openstack-ansible-functional-opensuse-423
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
- openstack-ansible-upgrade-ubuntu-xenial
|
||||
|
Loading…
Reference in New Issue
Block a user