Add openSUSE and CentOS as supported distributions

There is no distro specific code in this role so add openSUSE and
CentOS as supported distributions similarly to the rest of the
OpenStack Ansible roles. This also updates the run_tests.sh, bindep.txt
and Vagrantfile from the opentack-ansible-tests repository.

Change-Id: Ib540a8fc3474075393cc5ae351aee5d59bfa4853
This commit is contained in:
Markos Chandras 2017-04-10 22:55:16 +01:00
parent 5e1828ce6e
commit 8d040dc1df
4 changed files with 84 additions and 66 deletions

34
Vagrantfile vendored
View File

@ -1,12 +1,34 @@
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
config.vm.define "ubuntu1604" do |xenial|
xenial.vm.box = "ubuntu/xenial64"
xenial.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
end
config.vm.define "opensuse421" do |leap421|
leap421.vm.box = "opensuse/openSUSE-42.1-x86_64"
leap421.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
end
config.vm.define "centos7" do |centos7|
centos7.vm.box = "centos/7"
centos7.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
end
end

View File

@ -9,6 +9,18 @@
# is better to have this file empty, otherwise OpenStack-CI
# will fall back to installing its default packages which
# will potentially be detrimental to the tests executed.
#
# Note:
# This file is maintained in the openstack-ansible-tests repository.
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/bindep.txt
# If you need to remove or add extra dependencies, you should modify
# the central file instead and once your change is accepted then update
# this file as well. The purpose of this file is to ensure that Python and
# Ansible have all their necessary binary requirements on the test host before
# tox executes. Any binary requirements needed by services/roles should be
# installed by those roles in their applicable package install tasks, not through
# using this file.
#
# Base requirements for Ubuntu
build-essential [platform:dpkg]
@ -18,21 +30,26 @@ libffi-dev [platform:dpkg]
python2.7 [platform:dpkg]
python-dev [platform:dpkg]
# Base requirements for CentOS
# Base requirements for RPM distros
gcc [platform:rpm]
gcc-c++ [platform:rpm]
git [platform:rpm]
python-devel [platform:rpm]
libffi-devel [platform:rpm]
openssl-devel [platform:rpm]
python-devel [platform:rpm]
# For SELinux
libselinux-python [platform:rpm]
libselinux-python [platform:centos]
libsemanage-python [platform:centos]
# For SSL SNI support
python-pyasn1 [platform:dpkg]
python-openssl [platform:dpkg]
python-pyasn1 [platform:dpkg platform:suselinux]
python-openssl [platform:dpkg platform:suselinux]
python-ndg-httpsclient [platform:ubuntu]
python2-pyasn1 [platform:rpm]
python2-pyOpenSSL [platform:rpm]
python-ndg_httpsclient [platform:rpm]
python2-pyasn1 [platform:centos]
python2-pyOpenSSL [platform:centos]
python-pyOpenSSL [platform:suselinux]
python-ndg_httpsclient [platform:centos]
# Required for compressing collected log files in CI
gzip

View File

@ -23,6 +23,12 @@ galaxy_info:
- name: Ubuntu
versions:
- xenial
- name: EL
versions:
- 7
- name: opensuse
versions:
- all
categories:
- cloud
- rabbitmq

View File

@ -13,62 +13,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -xeuo pipefail
set -xeu
FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
source /etc/os-release || source /usr/lib/os-release
# Install python2 for Ubuntu 16.04 and CentOS 7
if which apt-get; then
sudo apt-get update && sudo apt-get install -y python
fi
install_pkg_deps() {
pkg_deps="git"
if which yum; then
sudo yum install -y python
fi
case ${ID,,} in
*suse*) pkg_mgr_cmd="zypper -n in" ;;
centos|rhel) pkg_mgr_cmd="yum 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
# Install pip.
if ! which pip; then
curl --silent --show-error --retry 5 \
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
fi
eval sudo $pkg_mgr_cmd $pkg_deps
}
# Install bindep and tox with pip.
sudo pip install bindep tox
# CentOS 7 requires two additional packages:
# redhat-lsb-core - for bindep profile support
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
if which yum; then
sudo yum -y install redhat-lsb-core epel-release
fi
# Get a list of packages to install with bindep. If packages need to be
# installed, bindep exits with an exit code of 1.
BINDEP_PKGS=$(bindep -b -f bindep.txt test || true)
echo "Packages to install: ${BINDEP_PKGS}"
# Install a list of OS packages provided by bindep.
if which apt-get; then
sudo apt-get update
DEBIAN_FRONTEND=noninteractive \
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install $BINDEP_PKGS
elif which yum; then
# Don't run yum with an empty list of packages.
# It will fail and cause the script to exit with an error.
if [[ ${#BINDEP_PKGS} > 0 ]]; then
sudo yum install -y $BINDEP_PKGS
git_clone_repo() {
if [[ ! -d tests/common ]]; then
git clone https://git.openstack.org/openstack/openstack-ansible-tests tests/common
fi
fi
}
# Loop through each tox environment and run tests.
for tox_env in $(awk -F= '/envlist/ { gsub(",", " "); print $2 }' tox.ini); do
echo "Executing tox environment: ${tox_env}"
if [[ ${tox_env} == ansible-functional ]]; then
if ${FUNCTIONAL_TEST}; then
tox -e ${tox_env}
fi
else
tox -e ${tox_env}
fi
done
install_pkg_deps
git_clone_repo
# start executing the main test script
source tests/common/run_tests.sh
# vim: set ts=4 sw=4 expandtab: