Updated from OpenStack Ansible Tests

Change-Id: Ia5e223493ec0e8469621ba9a8c90f9bc5d995426
This commit is contained in:
OpenStack Proposal Bot 2020-12-01 13:21:25 +00:00
parent c5fbb4d2f5
commit 1d3f4828c8
5 changed files with 116 additions and 69 deletions

26
.gitignore vendored
View File

@ -1,3 +1,14 @@
# Add patterns in here to exclude files created by tools integrated with this
# repository, such as test frameworks from the project's recommended workflow,
# rendered documentation and package builds.
#
# Don't add patterns to exclude files created by preferred personal tools
# (editors, IDEs, your operating system itself even). These should instead be
# maintained outside the repository, for example in a ~/.gitignore file added
# with:
#
# git config --global core.excludesfile '~/.gitignore'
# Compiled source #
###################
*.com
@ -33,25 +44,11 @@ logs/*
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
.idea
.tox
*.sublime*
*.egg-info
Icon?
ehthumbs.db
Thumbs.db
.eggs
# User driven backup files #
############################
*.bak
*.swp
# Generated by pbr while building docs
######################################
AUTHORS
@ -69,3 +66,4 @@ tests/*.retry
# Git clones
openstack-ansible-ops
previous

35
Vagrantfile vendored
View File

@ -1,6 +1,6 @@
# Note:
# This file is maintained in the openstack-ansible-tests repository.
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/Vagrantfile
# https://opendev.org/openstack/openstack-ansible-tests/src/Vagrantfile
#
# If you need to perform any change on it, you should modify the central file,
# then, an OpenStack CI job will propagate your changes to every OSA repository
@ -16,8 +16,10 @@ end
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 4096
v.memory = 6144
v.cpus = 2
# https://github.com/hashicorp/vagrant/issues/9524
v.customize ["modifyvm", :id, "--audio", "none"]
end
config.vm.synced_folder ".", "/vagrant", type: "rsync"
@ -29,21 +31,32 @@ Vagrant.configure(2) do |config|
./run_tests.sh
SHELL
config.vm.define "ubuntu1604" do |xenial|
xenial.disksize.size = "40GB"
xenial.vm.box = "ubuntu/xenial64"
config.vm.define "centos8" do |centos8|
centos8.vm.box = "centos/8"
end
config.vm.define "opensuse422" do |leap422|
leap422.vm.box = "opensuse/openSUSE-42.2-x86_64"
config.vm.define "debian8" do |debian8|
debian8.vm.box = "debian/jessie64"
end
config.vm.define "opensuse423" do |leap423|
leap423.vm.box = "opensuse/openSUSE-42.3-x86_64"
config.vm.define "debian9" do |debian9|
debian9.vm.box = "debian/stretch64"
end
config.vm.define "centos7" do |centos7|
centos7.vm.box = "centos/7"
config.vm.define "gentoo" do |gentoo|
gentoo.vm.box = "generic/gentoo"
end
config.vm.define "opensuse150" do |leap150|
leap150.vm.box = "opensuse/openSUSE-15.0-x86_64"
end
config.vm.define "opensuse151" do |leap151|
leap151.vm.box = "opensuse/openSUSE-15.1-x86_64"
end
config.vm.define "ubuntu1804" do |bionic|
bionic.disksize.size = "40GB"
bionic.vm.box = "ubuntu/bionic64"
end
end

View File

@ -3,7 +3,7 @@
#
# See the following for details:
# - https://docs.openstack.org/infra/bindep/
# - https://git.openstack.org/cgit/openstack-infra/bindep
# - https://opendev.org/openstack-infra/bindep
#
# Even if the role does not make use of this facility, it
# is better to have this file empty, otherwise OpenStack-CI
@ -12,7 +12,7 @@
#
# Note:
# This file is maintained in the openstack-ansible-tests repository.
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/bindep.txt
# https://opendev.org/openstack/openstack-ansible-tests/src/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
@ -26,24 +26,25 @@
gcc
# Base requirements for Ubuntu
git-core [platform:dpkg]
git-core [platform:dpkg platform:suse]
libssl-dev [platform:dpkg]
libffi-dev [platform:dpkg]
python2.7 [platform:dpkg]
python-apt [platform:dpkg]
python-dev [platform:dpkg]
python3 [platform:dpkg]
python3-apt [platform:dpkg]
python3-dev [platform:dpkg]
# Base requirements for RPM distros
gcc-c++ [platform:rpm]
git [platform:rpm]
git [platform:rpm !platform:suse]
libffi-devel [platform:rpm]
openssl-devel [platform:rpm]
python-devel [platform:rpm]
python2-dnf [platform:fedora]
python3-dnf [platform:fedora]
python3-devel [platform:rpm]
# Base requirements for Gentoo
git [platform:gentoo]
# For SELinux
libselinux-python [platform:redhat]
libsemanage-python [platform:redhat]
# Required for compressing collected log files in CI
gzip
libselinux-python3 [platform:redhat]
libsemanage-python3 [platform:redhat]
iptables [platform:redhat]

View File

@ -12,10 +12,16 @@
# 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
# https://opendev.org/openstack/openstack-ansible-tests/src/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.
@ -26,34 +32,63 @@ set -xeu
## Vars ----------------------------------------------------------------------
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
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}
ZUUL_TESTS_CLONE_LOCATION="/home/zuul/src/opendev.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"
# Figure out the appropriate package install command
case ${ID,,} in
*suse*) pkg_mgr_cmd="zypper -n in" ;;
centos|rhel|fedora) pkg_mgr_cmd="dnf install -y" ;;
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
# Gentoo needs to have version set since it's rolling
gentoo) pkg_mgr_cmd="emerge --jobs=4"; VERSION="rolling" ;;
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
esac
# Prefer dnf over yum for CentOS.
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
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 if git is not available
case ${ID,,} in
gentoo) which git &>/dev/null || eval sudo "${pkg_mgr_cmd}" dev-vcs/git ;;
*) which git &>/dev/null || eval sudo "${pkg_mgr_cmd}" git ;;
esac
# 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 [[ "${OSA_PROJECT_NAME}" == "openstack-ansible-tests" ]]; then
ln -s "${WORKING_DIR}" "${COMMON_TESTS_PATH}"
# In zuul v3 any dependent repository is placed into
# /home/zuul/src/opendev.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://opendev.org/openstack/openstack-ansible-tests \
"${COMMON_TESTS_PATH}"
fi
fi
# Execute the common test script
source tests/common/run_tests_common.sh

View File

@ -32,7 +32,7 @@
ansible_python_interpreter: "{{ _service_setup_host_python_interpreter }}"
block:
- name: Add keystone domain
openstack.cloud.os_keystone_domain:
openstack.cloud.identity_domain:
cloud: default
state: present
description: "{{ _domain_name_description | default(omit) }}"
@ -46,7 +46,7 @@
delay: 10
- name: Add service project
openstack.cloud.os_project:
openstack.cloud.project:
cloud: default
state: present
name: "{{ _project_name }}"
@ -63,7 +63,7 @@
delay: 10
- name: Add services to the keystone service catalog
openstack.cloud.os_keystone_service:
openstack.cloud.catalog_service:
cloud: default
state: "{{ item.state | default('present') }}"
name: "{{ item.name }}"
@ -79,7 +79,7 @@
delay: 10
- name: Add keystone roles
openstack.cloud.os_keystone_role:
openstack.cloud.identity_role:
cloud: default
state: present
name: "{{ item.role }}"
@ -98,7 +98,7 @@
no_log: True
- name: Add service users
openstack.cloud.os_user:
openstack.cloud.identity_user:
cloud: default
state: present
name: "{{ item.name }}"
@ -122,7 +122,7 @@
no_log: True
- name: Add service users to the role
openstack.cloud.os_user_role:
openstack.cloud.role_assignment:
cloud: default
state: present
user: "{{ item.name }}"
@ -145,7 +145,7 @@
no_log: True
- name: Add endpoints to keystone endpoint catalog
openstack.cloud.os_keystone_endpoint:
openstack.cloud.endpoint:
cloud: default
state: "{{ item.state | default('present') }}"
service: "{{ item.service }}"