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 # # Compiled source #
################### ###################
*.com *.com
@ -33,25 +44,11 @@ logs/*
# OS generated files # # OS generated files #
###################### ######################
.DS_Store
.DS_Store?
._* ._*
.Spotlight-V100
.Trashes
.idea
.tox .tox
*.sublime*
*.egg-info *.egg-info
Icon?
ehthumbs.db
Thumbs.db
.eggs .eggs
# User driven backup files #
############################
*.bak
*.swp
# Generated by pbr while building docs # Generated by pbr while building docs
###################################### ######################################
AUTHORS AUTHORS
@ -69,3 +66,4 @@ tests/*.retry
# Git clones # Git clones
openstack-ansible-ops openstack-ansible-ops
previous

35
Vagrantfile vendored
View File

@ -1,6 +1,6 @@
# Note: # Note:
# This file is maintained in the openstack-ansible-tests repository. # 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, # 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 # then, an OpenStack CI job will propagate your changes to every OSA repository
@ -16,8 +16,10 @@ end
Vagrant.configure(2) do |config| Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |v| config.vm.provider "virtualbox" do |v|
v.memory = 4096 v.memory = 6144
v.cpus = 2 v.cpus = 2
# https://github.com/hashicorp/vagrant/issues/9524
v.customize ["modifyvm", :id, "--audio", "none"]
end end
config.vm.synced_folder ".", "/vagrant", type: "rsync" config.vm.synced_folder ".", "/vagrant", type: "rsync"
@ -29,21 +31,32 @@ Vagrant.configure(2) do |config|
./run_tests.sh ./run_tests.sh
SHELL SHELL
config.vm.define "ubuntu1604" do |xenial| config.vm.define "centos8" do |centos8|
xenial.disksize.size = "40GB" centos8.vm.box = "centos/8"
xenial.vm.box = "ubuntu/xenial64"
end end
config.vm.define "opensuse422" do |leap422| config.vm.define "debian8" do |debian8|
leap422.vm.box = "opensuse/openSUSE-42.2-x86_64" debian8.vm.box = "debian/jessie64"
end end
config.vm.define "opensuse423" do |leap423| config.vm.define "debian9" do |debian9|
leap423.vm.box = "opensuse/openSUSE-42.3-x86_64" debian9.vm.box = "debian/stretch64"
end end
config.vm.define "centos7" do |centos7| config.vm.define "gentoo" do |gentoo|
centos7.vm.box = "centos/7" gentoo.vm.box = "generic/gentoo"
end 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 end

View File

@ -3,7 +3,7 @@
# #
# See the following for details: # See the following for details:
# - https://docs.openstack.org/infra/bindep/ # - 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 # Even if the role does not make use of this facility, it
# is better to have this file empty, otherwise OpenStack-CI # is better to have this file empty, otherwise OpenStack-CI
@ -12,7 +12,7 @@
# #
# Note: # Note:
# This file is maintained in the openstack-ansible-tests repository. # 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 # If you need to remove or add extra dependencies, you should modify
# the central file instead and once your change is accepted then update # 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 # this file as well. The purpose of this file is to ensure that Python and
@ -26,24 +26,25 @@
gcc gcc
# Base requirements for Ubuntu # Base requirements for Ubuntu
git-core [platform:dpkg] git-core [platform:dpkg platform:suse]
libssl-dev [platform:dpkg] libssl-dev [platform:dpkg]
libffi-dev [platform:dpkg] libffi-dev [platform:dpkg]
python2.7 [platform:dpkg] python3 [platform:dpkg]
python-apt [platform:dpkg] python3-apt [platform:dpkg]
python-dev [platform:dpkg] python3-dev [platform:dpkg]
# Base requirements for RPM distros # Base requirements for RPM distros
gcc-c++ [platform:rpm] gcc-c++ [platform:rpm]
git [platform:rpm] git [platform:rpm !platform:suse]
libffi-devel [platform:rpm] libffi-devel [platform:rpm]
openssl-devel [platform:rpm] openssl-devel [platform:rpm]
python-devel [platform:rpm] python3-dnf [platform:fedora]
python2-dnf [platform:fedora] python3-devel [platform:rpm]
# Base requirements for Gentoo
git [platform:gentoo]
# For SELinux # For SELinux
libselinux-python [platform:redhat] libselinux-python3 [platform:redhat]
libsemanage-python [platform:redhat] libsemanage-python3 [platform:redhat]
iptables [platform:redhat]
# Required for compressing collected log files in CI
gzip

View File

@ -12,10 +12,16 @@
# 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: # 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. # 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 # 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 # 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. # prepare the host and then execute all the tox tests.
@ -26,34 +32,63 @@ set -xeu
## Vars ---------------------------------------------------------------------- ## 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 ---------------------------------------------------------------------- ## Main ----------------------------------------------------------------------
# Source distribution information
source /etc/os-release || source /usr/lib/os-release source /etc/os-release || source /usr/lib/os-release
install_pkg_deps() { # Figure out the appropriate package install command
pkg_deps="git" 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. # Install git so that we can clone the tests repo if git is not available
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum' case ${ID,,} in
gentoo) which git &>/dev/null || eval sudo "${pkg_mgr_cmd}" dev-vcs/git ;;
case ${ID,,} in *) which git &>/dev/null || eval sudo "${pkg_mgr_cmd}" git ;;
*suse*) pkg_mgr_cmd="zypper -n in" ;; esac
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
# Clone the tests repo for access to the common test script # 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 # Execute the common test script
source tests/common/run_tests_common.sh source tests/common/run_tests_common.sh

View File

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