Updated from OpenStack Ansible Tests
Change-Id: Ie4e5326b5c667e35325c695d7781a3e0c886f243
This commit is contained in:
parent
8b492e0f67
commit
fad0c2fd43
|
@ -61,13 +61,11 @@ ChangeLog
|
||||||
releasenotes/build
|
releasenotes/build
|
||||||
|
|
||||||
# Test temp files
|
# Test temp files
|
||||||
tests/plugins
|
|
||||||
tests/playbooks
|
|
||||||
tests/common
|
tests/common
|
||||||
tests/*.retry
|
tests/*.retry
|
||||||
|
|
||||||
# Vagrant artifacts
|
# Vagrant artifacts
|
||||||
.vagrant
|
.vagrant
|
||||||
|
|
||||||
# IDE created files
|
# Git clones
|
||||||
.idea/
|
openstack-ansible-ops
|
||||||
|
|
|
@ -1,9 +1,47 @@
|
||||||
Vagrant.configure(2) do |config|
|
# Note:
|
||||||
config.vm.box = "ubuntu/xenial64"
|
# This file is maintained in the openstack-ansible-tests repository.
|
||||||
config.vm.provision "shell", inline: <<-SHELL
|
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/Vagrantfile
|
||||||
sudo su -
|
#
|
||||||
cd /vagrant
|
# If you need to perform any change on it, you should modify the central file,
|
||||||
apt-get update
|
# then, an OpenStack CI job will propagate your changes to every OSA repository
|
||||||
./run_tests.sh
|
# since every repo uses the same Vagrantfile
|
||||||
SHELL
|
|
||||||
|
# Verify whether required plugins are installed.
|
||||||
|
required_plugins = [ "vagrant-disksize" ]
|
||||||
|
required_plugins.each do |plugin|
|
||||||
|
if not Vagrant.has_plugin?(plugin)
|
||||||
|
raise "The vagrant plugin #{plugin} is required. Please run `vagrant plugin install #{plugin}`"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Vagrant.configure(2) do |config|
|
||||||
|
config.vm.provider "virtualbox" do |v|
|
||||||
|
v.memory = 4096
|
||||||
|
v.cpus = 2
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.provision "shell",
|
||||||
|
privileged: false,
|
||||||
|
inline: <<-SHELL
|
||||||
|
cd /vagrant
|
||||||
|
./run_tests.sh
|
||||||
|
SHELL
|
||||||
|
|
||||||
|
config.vm.define "ubuntu1604" do |xenial|
|
||||||
|
xenial.disksize.size = "40GB"
|
||||||
|
xenial.vm.box = "ubuntu/xenial64"
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.define "opensuse422" do |leap422|
|
||||||
|
leap422.vm.box = "opensuse/openSUSE-42.2-x86_64"
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.define "opensuse423" do |leap423|
|
||||||
|
leap423.vm.box = "opensuse/openSUSE-42.3-x86_64"
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.define "centos7" do |centos7|
|
||||||
|
centos7.vm.box = "centos/7"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
75
run_tests.sh
75
run_tests.sh
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright 2016, Rackspace US, Inc.
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -12,32 +12,61 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# Note:
|
||||||
|
# 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
|
||||||
|
# repository and then update this file as well. The purpose of this file is to
|
||||||
|
# prepare the host and then execute all the tox tests.
|
||||||
|
#
|
||||||
|
|
||||||
set -euov
|
## Shell Opts ----------------------------------------------------------------
|
||||||
|
set -xeu
|
||||||
|
|
||||||
FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
|
## Vars ----------------------------------------------------------------------
|
||||||
|
|
||||||
# prep the host
|
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
|
||||||
if [ "$(which apt-get)" ]; then
|
|
||||||
apt-get install -y build-essential python2.7 python-dev git-core libssl-dev libffi-dev
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get pip, if necessary
|
## Main ----------------------------------------------------------------------
|
||||||
if [ ! "$(which pip)" ]; then
|
|
||||||
curl --silent --show-error --retry 5 \
|
|
||||||
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install tox
|
source /etc/os-release || source /usr/lib/os-release
|
||||||
pip install tox
|
|
||||||
|
|
||||||
# run through each tox env and execute the test
|
install_pkg_deps() {
|
||||||
for tox_env in $(awk -F= '/envlist/ {print $2}' tox.ini | sed 's/,/ /g'); do
|
pkg_deps="git"
|
||||||
if [ "${tox_env}" != "functional" ]; then
|
|
||||||
tox -e ${tox_env}
|
# Prefer dnf over yum for CentOS.
|
||||||
elif [ "${tox_env}" == "functional" ]; then
|
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||||
if ${FUNCTIONAL_TEST}; then
|
|
||||||
tox -e ${tox_env}
|
case ${ID,,} in
|
||||||
|
*suse*) pkg_mgr_cmd="zypper -n in" ;;
|
||||||
|
centos|rhel) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
|
||||||
|
fedora) pkg_mgr_cmd="dnf -y install" ;;
|
||||||
|
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
|
||||||
|
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
eval sudo $pkg_mgr_cmd $pkg_deps
|
||||||
|
}
|
||||||
|
|
||||||
|
git_clone_repo() {
|
||||||
|
if [[ ! -d tests/common ]]; 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} ${WORKING_DIR}/tests/common
|
||||||
|
else
|
||||||
|
git clone \
|
||||||
|
https://git.openstack.org/openstack/openstack-ansible-tests \
|
||||||
|
tests/common
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
done
|
|
||||||
|
install_pkg_deps
|
||||||
|
|
||||||
|
git_clone_repo
|
||||||
|
|
||||||
|
# start executing the main test script
|
||||||
|
source tests/common/run_tests_common.sh
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue