Role requirements and tests
This commit is contained in:
parent
0c0f7b189e
commit
547ebfcff5
72
.gitignore
vendored
Normal file
72
.gitignore
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
*.pyc
|
||||
build/
|
||||
dist/
|
||||
doc/build/
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
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
|
||||
ChangeLog
|
||||
|
||||
# Files created by releasenotes build
|
||||
releasenotes/build
|
||||
|
||||
# Test temp files
|
||||
tests/common
|
||||
tests/*.retry
|
||||
|
||||
# Vagrant artifacts
|
||||
.vagrant
|
||||
|
||||
# Git clones
|
||||
openstack-ansible-ops
|
||||
previous
|
4
.gitreview
Normal file
4
.gitreview
Normal file
@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/openstack-ansible.git
|
44
Vagrantfile
vendored
Normal file
44
Vagrantfile
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# Note:
|
||||
# This file is maintained in the openstack-ansible-tests repository.
|
||||
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/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
|
||||
# since every repo uses the same Vagrantfile
|
||||
|
||||
# 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 = 6144
|
||||
v.cpus = 2
|
||||
end
|
||||
|
||||
config.vm.synced_folder ".", "/vagrant", type: "rsync"
|
||||
|
||||
config.vm.provision "shell",
|
||||
privileged: false,
|
||||
inline: <<-SHELL
|
||||
cd /vagrant
|
||||
./run_tests.sh
|
||||
SHELL
|
||||
|
||||
config.vm.define "ubuntu1604" do |xenial|
|
||||
xenial.vm.box = "bento/ubuntu-16.04"
|
||||
end
|
||||
|
||||
config.vm.define "opensuse423" do |leap423|
|
||||
leap423.vm.box = "bento/opensuse-leap-42.3"
|
||||
end
|
||||
|
||||
config.vm.define "centos7" do |centos7|
|
||||
centos7.vm.box = "bento/centos-7"
|
||||
end
|
||||
|
||||
end
|
52
bindep.txt
Normal file
52
bindep.txt
Normal file
@ -0,0 +1,52 @@
|
||||
# This file facilitates OpenStack-CI package installation
|
||||
# before the execution of any tests.
|
||||
#
|
||||
# See the following for details:
|
||||
# - https://docs.openstack.org/infra/bindep/
|
||||
# - https://git.openstack.org/cgit/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
|
||||
# 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.
|
||||
#
|
||||
|
||||
# The gcc compiler
|
||||
gcc
|
||||
|
||||
# Base requirements for Ubuntu
|
||||
git-core [platform:dpkg]
|
||||
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]
|
||||
libffi-devel [platform:rpm]
|
||||
openssl-devel [platform:rpm]
|
||||
python-devel [platform:rpm]
|
||||
python2-dnf [platform:fedora]
|
||||
|
||||
# For SELinux
|
||||
libselinux-python [platform:redhat]
|
||||
libsemanage-python [platform:redhat]
|
||||
|
||||
# Required for compressing collected log files in CI
|
||||
gzip
|
@ -40,3 +40,9 @@ qdrouterd_sasl_conf_path: "/etc/sasl2/"
|
||||
qdrouterd_sasl_conf_file: "/etc/sasl2/qdrouterd.conf"
|
||||
qdrouterd_log_module: "DEFAULT"
|
||||
qdrouterd_log_enable: "info+"
|
||||
|
||||
# Qdrouterd SSL support
|
||||
qdrouterd_require_ssl: "yes"
|
||||
qdrouterd_ssl_cert: /etc/qdrouterd/ssl/qdrouterd.pem
|
||||
qdrouterd_ssl_key: /etc/qdrouterd/ssl/qdrouterd.key
|
||||
#qdrouterd_ssl_ca_cert: /etc/qdrouterd/ssl/qdrouterd-ca.pem
|
||||
|
93
run_tests.sh
Executable file
93
run_tests.sh
Executable file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
# 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
## Shell Opts ----------------------------------------------------------------
|
||||
set -xeu
|
||||
|
||||
## Vars ----------------------------------------------------------------------
|
||||
|
||||
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
|
||||
|
||||
# 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" ;;
|
||||
gentoo) pkg_mgr_cmd="emerge" ;;
|
||||
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Install git so that we can clone the tests repo if git is not available
|
||||
which git &>/dev/null || eval sudo "${pkg_mgr_cmd}" git
|
||||
|
||||
# Clone the tests repo for access to the common test script
|
||||
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
|
||||
|
21
setup.cfg
Normal file
21
setup.cfg
Normal file
@ -0,0 +1,21 @@
|
||||
[metadata]
|
||||
name = ansible-qdrouterd
|
||||
summary = qdrouterd for Ansible
|
||||
description-file =
|
||||
README.rst
|
||||
classifier =
|
||||
Intended Audience :: Developers
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
build-dir = doc/build
|
||||
source-dir = doc/source
|
||||
|
||||
[pbr]
|
||||
warnerrors = True
|
||||
|
||||
[wheel]
|
||||
universal = 1
|
29
setup.py
Normal file
29
setup.py
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||
# setuptools if some other modules registered functions in `atexit`.
|
||||
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||
try:
|
||||
import multiprocessing # noqa
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr>=2.0.0'],
|
||||
pbr=True)
|
@ -7,6 +7,17 @@ router {
|
||||
saslConfigName: {{ qdrouterd_service_name }}
|
||||
}
|
||||
|
||||
{% if qdrouterd_require_ssl == 'yes' %}
|
||||
sslProfile {
|
||||
name: {{ ansible_hostname }}
|
||||
{% if qdrouterd_ssl_ca_cert is defined %}
|
||||
certDb: {{ qdrouterd_ssl_ca_cert }}
|
||||
{% endif %}
|
||||
certFile: {{ qdrouterd_ssl_cert }}
|
||||
keyFile: {{ qdrouterd_ssl_key }}
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
listener {
|
||||
host: {{ qdrouterd_listener_addr }}
|
||||
port: {{ qdrouterd_listener_port }}
|
||||
|
9
test-requirements.txt
Normal file
9
test-requirements.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
bashate>=0.5.1 # Apache-2.0
|
||||
flake8<2.6.0,>=2.5.4 # MIT
|
||||
pyasn1!=0.2.3,>=0.1.8 # BSD
|
||||
pyOpenSSL>=17.1.0 # Apache-2.0
|
||||
requests>=2.14.2 # Apache-2.0
|
||||
ndg-httpsclient>=0.4.2;python_version<'3.0' # BSD
|
24
tests/ansible-role-requirements.yml
Normal file
24
tests/ansible-role-requirements.yml
Normal file
@ -0,0 +1,24 @@
|
||||
- name: apt_package_pinning
|
||||
src: https://git.openstack.org/openstack/openstack-ansible-apt_package_pinning
|
||||
scm: git
|
||||
version: master
|
||||
- name: pip_install
|
||||
src: https://git.openstack.org/openstack/openstack-ansible-pip_install
|
||||
scm: git
|
||||
version: master
|
||||
- name: openstack_hosts
|
||||
src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts
|
||||
scm: git
|
||||
version: master
|
||||
- name: lxc_hosts
|
||||
src: https://git.openstack.org/openstack/openstack-ansible-lxc_hosts
|
||||
scm: git
|
||||
version: master
|
||||
- name: lxc_container_create
|
||||
src: https://git.openstack.org/openstack/openstack-ansible-lxc_container_create
|
||||
scm: git
|
||||
version: master
|
||||
- name: previous_qdrouterd_server
|
||||
src: https://github.com/ajssmith/ansible-qdrouterd
|
||||
scm: git
|
||||
version: master
|
26
tests/group_vars/all_containers.yml
Normal file
26
tests/group_vars/all_containers.yml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
# Copyright 2018, Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
container_name: "{{ inventory_hostname }}"
|
||||
container_networks:
|
||||
management_address:
|
||||
address: "{{ ansible_host }}"
|
||||
bridge: "br-mgmt"
|
||||
interface: "eth1"
|
||||
netmask: "255.255.255.0"
|
||||
type: "veth"
|
||||
physical_host: localhost
|
||||
properties:
|
||||
service_name: "{{ inventory_hostname }}"
|
18
tests/host_vars/container1.yml
Normal file
18
tests/host_vars/container1.yml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
# Copyright 2017, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
ansible_host: 10.1.0.2
|
||||
ansible_become: True
|
||||
ansible_user: root
|
18
tests/host_vars/container2.yml
Normal file
18
tests/host_vars/container2.yml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
# Copyright 2017, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
ansible_host: 10.1.0.3
|
||||
ansible_become: True
|
||||
ansible_user: root
|
18
tests/host_vars/container3.yml
Normal file
18
tests/host_vars/container3.yml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
# Copyright 2017, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
ansible_host: 10.1.0.4
|
||||
ansible_become: True
|
||||
ansible_user: root
|
19
tests/host_vars/localhost.yml
Normal file
19
tests/host_vars/localhost.yml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
# Copyright 2016, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
bridges:
|
||||
- "br-mgmt"
|
||||
|
||||
ansible_python_interpreter: "/usr/bin/python2"
|
@ -1,2 +1,14 @@
|
||||
[all]
|
||||
localhost
|
||||
container1
|
||||
container2
|
||||
container3
|
||||
|
||||
[qdrouterd_all]
|
||||
container1
|
||||
container2
|
||||
container3
|
||||
|
||||
[all_containers:children]
|
||||
qdrouterd_all
|
||||
|
||||
|
2
tests/qdrouterd-overrides.yml
Normal file
2
tests/qdrouterd-overrides.yml
Normal file
@ -0,0 +1,2 @@
|
||||
qdrouterd_ssl_cert: /etc/qpid-dispatch/ssl/qdrouterd.pem
|
||||
qdrouterd_ssl_key: /etc/qpid-dispatch/ssl/qdrouterd.key
|
31
tests/test-install-previous-qdrouterd.yml
Normal file
31
tests/test-install-previous-qdrouterd.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
# Copyright 2018, Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
- name: Gather facts
|
||||
hosts: "all"
|
||||
user: root
|
||||
gather_facts: true
|
||||
|
||||
# Install previous version
|
||||
- name: Deploy previous qdrouterd version
|
||||
hosts: qdrouterd_all
|
||||
user: root
|
||||
serial: 1
|
||||
any_errors_fatal: true
|
||||
gather_facts: true
|
||||
roles:
|
||||
- role: "previous_qdrouterd_server"
|
||||
vars_files:
|
||||
- common/previous/test-vars.yml
|
81
tests/test-qdrouterd-functional.yml
Normal file
81
tests/test-qdrouterd-functional.yml
Normal file
@ -0,0 +1,81 @@
|
||||
---
|
||||
# Copyright 2018, Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
- name: Run functional tests
|
||||
hosts: qdrouterd_all
|
||||
any_errors_fatal: true
|
||||
user: root
|
||||
gather_facts: true
|
||||
become: true
|
||||
tasks:
|
||||
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ playbook_dir }}/../vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
||||
- "{{ playbook_dir }}/../vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ playbook_dir }}/../vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ playbook_dir }}/../vars/{{ ansible_distribution | lower }}.yml"
|
||||
- "{{ playbook_dir }}/../vars/{{ ansible_os_family | lower }}.yml"
|
||||
|
||||
- name: Check qdrouterd is running
|
||||
command: "pgrep -f qdrouterd"
|
||||
delegate_to: "{{ item }}"
|
||||
when: ansible_host == item
|
||||
with_items:
|
||||
- 10.1.0.2
|
||||
- 10.1.0.3
|
||||
- 10.1.0.4
|
||||
|
||||
- name: Open qdrouterd.conf
|
||||
slurp:
|
||||
src: "{{ qdrouterd_etc_conf_file }}"
|
||||
register: qdrouterd_config
|
||||
|
||||
- name: Read qdrouterd_ssl_cert
|
||||
stat:
|
||||
path: "{{ qdrouterd_ssl_cert }}"
|
||||
register: qdrouterd_ssl_cert_stat
|
||||
|
||||
- name: Read qdrouterd_ssl_key
|
||||
stat:
|
||||
path: "{{ qdrouterd_ssl_key }}"
|
||||
register: qdrouterd_ssl_key_stat
|
||||
|
||||
- name: Read qdrouterd files
|
||||
set_fact:
|
||||
qdrouterd_config_contents: "{{ qdrouterd_config.content | b64decode }}"
|
||||
qdrouterd_ssl_cert_checksum: "{{ qdrouterd_ssl_cert_stat.stat.checksum }}"
|
||||
qdrouterd_ssl_key_checksum: "{{ qdrouterd_ssl_key_stat.stat.checksum }}"
|
||||
|
||||
- name: Check files contents
|
||||
assert:
|
||||
that:
|
||||
- "'workerThreads' in qdrouterd_config_contents"
|
||||
|
||||
- name: Get general statistics of qdrouterd
|
||||
command: "qdstat -g -b 0.0.0.0:31459"
|
||||
register: qdrouterd_statistics
|
||||
changed_when: false
|
||||
|
||||
- name: Print qdrouterd_statistics
|
||||
debug:
|
||||
var: qdrotuerd_statistics
|
||||
|
||||
- name: Ensure SSL cert/key checksums are identical across the mesh
|
||||
assert:
|
||||
that:
|
||||
- hostvars['container1']['qdrotuerd_ssl_cert_checksum'] == hostvars['container2']['qdrouterd_ssl_cert_checksum'] == hostvars['container3']['qdrouterd_ssl_cert_checksum']
|
||||
- hostvars['container1']['qdrouterd_ssl_key_checksum'] == hostvars['container2']['qdrouterd_ssl_key_checksum'] == hostvars['container3']['qdrouterd_ssl_key_checksum']
|
98
tests/test-qdrouterd-upgrades.sh
Executable file
98
tests/test-qdrouterd-upgrades.sh
Executable file
@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018, Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
# WARNING:
|
||||
# This file is use by all OpenStack-Ansible roles for testing purposes.
|
||||
# Any changes here will affect all OpenStack-Ansible role repositories
|
||||
# with immediate effect.
|
||||
|
||||
# PURPOSE:
|
||||
# This script executes test Ansible playbooks required for performing
|
||||
# an upgrade test of the role.
|
||||
|
||||
## Shell Opts ----------------------------------------------------------------
|
||||
|
||||
set -e
|
||||
|
||||
## Vars ----------------------------------------------------------------------
|
||||
|
||||
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
|
||||
export ROLE_NAME=${ROLE_NAME:-''}
|
||||
|
||||
export ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-""}
|
||||
export TEST_PLAYBOOK=${TEST_PLAYBOOK:-$WORKING_DIR/tests/test-upgrade-pre.yml}
|
||||
export TEST_CHECK_MODE=${TEST_CHECK_MODE:-false}
|
||||
export TEST_IDEMPOTENCE=${TEST_IDEMPOTENCE:-false}
|
||||
export COMMON_TESTS_PATH="${WORKING_DIR}/tests/common"
|
||||
|
||||
echo "ANSIBLE_OVERRIDES: ${ANSIBLE_OVERRIDES}"
|
||||
echo "ANSIBLE_PARAMETERS: ${ANSIBLE_PARAMETERS}"
|
||||
echo "TEST_PLAYBOOK: ${TEST_PLAYBOOK}"
|
||||
echo "TEST_CHECK_MODE: ${TEST_CHECK_MODE}"
|
||||
echo "TEST_IDEMPOTENCE: ${TEST_IDEMPOTENCE}"
|
||||
|
||||
## Functions -----------------------------------------------------------------
|
||||
|
||||
function execute_ansible_playbook {
|
||||
|
||||
export ANSIBLE_CLI_PARAMETERS="${ANSIBLE_PARAMETERS} -e @${ANSIBLE_OVERRIDES}"
|
||||
export ANSIBLE_BIN=${ANSIBLE_BIN:-"ansible-playbook"}
|
||||
CMD_TO_EXECUTE="${ANSIBLE_BIN} ${TEST_PLAYBOOK} $@ ${ANSIBLE_CLI_PARAMETERS}"
|
||||
|
||||
echo "Executing: ${CMD_TO_EXECUTE}"
|
||||
echo "With:"
|
||||
echo " ANSIBLE_INVENTORY: ${ANSIBLE_INVENTORY}"
|
||||
echo " ANSIBLE_LOG_PATH: ${ANSIBLE_LOG_PATH}"
|
||||
|
||||
${CMD_TO_EXECUTE}
|
||||
|
||||
}
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
|
||||
# Ensure that the Ansible environment is properly prepared
|
||||
source "${COMMON_TESTS_PATH}/test-ansible-env-prep.sh"
|
||||
|
||||
# Prepare environment for the initial deploy of (previous and current) Galera
|
||||
# No upgrading or testing is done yet.
|
||||
export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-upgrade-pre.yml"
|
||||
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-install.log"
|
||||
|
||||
# Execute the setup of previous version
|
||||
execute_ansible_playbook
|
||||
|
||||
# Create an ansible venv matching previous branch
|
||||
source ${WORKING_DIR}/tests/common/test-create-previous-venv.sh
|
||||
|
||||
# Prepare environment for the deploy of previous Qdrouterd:
|
||||
# No upgrading or testing is done yet.
|
||||
export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-install-previous-qdrouterd.yml"
|
||||
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-previous_qdrouterd-install.log"
|
||||
export PREVIOUS_VENV="ansible-previous"
|
||||
export ANSIBLE_BIN="${WORKING_DIR}/.tox/${PREVIOUS_VENV}/bin/ansible-playbook"
|
||||
|
||||
# Execute the setup of previous Keystone
|
||||
execute_ansible_playbook
|
||||
# Unset previous branch overrides
|
||||
unset PREVIOUS_VENV
|
||||
unset ANSIBLE_BIN
|
||||
|
||||
# Prepare environment for the upgrade
|
||||
export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-upgrade-post.yml"
|
||||
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-upgrade.log"
|
||||
|
||||
# Execute the upgrade
|
||||
execute_ansible_playbook
|
20
tests/test-upgrade-post.yml
Normal file
20
tests/test-upgrade-post.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
# Copyright 2018, Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
# Install Qdrouterd server
|
||||
- include: common/test-install-qdrouterd.yml
|
||||
|
||||
# Run functional tests
|
||||
- include: test-qdrouterd-functional.yml
|
17
tests/test-upgrade-pre.yml
Normal file
17
tests/test-upgrade-pre.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
# Setup the host
|
||||
- include: common/test-setup-host.yml
|
@ -1,5 +1,23 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- ansible-qdrouterd
|
||||
# Copyright 2018, Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
# Setup the host
|
||||
- include: common/test-setup-host.yml
|
||||
|
||||
# Install previous version qdrouterd server
|
||||
- include: common/test-install-qdrouterd.yml
|
||||
|
||||
# Run functional tests
|
||||
- include: test-qdrouterd-server-functional.yml
|
||||
|
122
tox.ini
Normal file
122
tox.ini
Normal file
@ -0,0 +1,122 @@
|
||||
[tox]
|
||||
minversion = 2.0
|
||||
skipsdist = True
|
||||
envlist = docs,linters,functional
|
||||
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command =
|
||||
pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
/usr/bin/find . -type f -name "*.pyc" -delete
|
||||
passenv =
|
||||
HOME
|
||||
USER
|
||||
http_proxy
|
||||
HTTP_PROXY
|
||||
https_proxy
|
||||
HTTPS_PROXY
|
||||
no_proxy
|
||||
NO_PROXY
|
||||
whitelist_externals =
|
||||
bash
|
||||
setenv =
|
||||
PYTHONUNBUFFERED=1
|
||||
ROLE_NAME=qdrouterd
|
||||
TEST_IDEMPOTENCE=false
|
||||
VIRTUAL_ENV={envdir}
|
||||
WORKING_DIR={toxinidir}
|
||||
|
||||
|
||||
[testenv:docs]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands=
|
||||
bash -c "rm -rf doc/build"
|
||||
doc8 doc
|
||||
sphinx-build -b html doc/source doc/build/html
|
||||
|
||||
|
||||
[doc8]
|
||||
# Settings for doc8:
|
||||
extensions = .rst
|
||||
|
||||
|
||||
[testenv:releasenotes]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
|
||||
# environment used by the -infra templated docs job
|
||||
[testenv:venv]
|
||||
commands =
|
||||
{posargs}
|
||||
|
||||
|
||||
[testenv:pep8]
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/common/test-pep8.sh"
|
||||
|
||||
|
||||
[flake8]
|
||||
# Ignores the following rules due to how ansible modules work in general
|
||||
# F403 'from ansible.module_utils.basic import *' used;
|
||||
# unable to detect undefined names
|
||||
ignore=F403
|
||||
|
||||
|
||||
[testenv:bashate]
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/common/test-bashate.sh"
|
||||
|
||||
|
||||
[testenv:ansible]
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
-rhttps://git.openstack.org/cgit/openstack/openstack-ansible/plain/global-requirement-pins.txt
|
||||
-rhttps://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt
|
||||
|
||||
|
||||
[testenv:ansible-syntax]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh"
|
||||
|
||||
|
||||
[testenv:ansible-lint]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-lint.sh"
|
||||
|
||||
|
||||
[testenv:functional]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
[testenv:upgrade]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_OVERRIDES={toxinidir}/tests/qdrouterd-overrides.yml
|
||||
CLONE_UPGRADE_TESTS=yes
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/test-qdrouterd-upgrades.sh"
|
||||
|
||||
|
||||
[testenv:linters]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
commands =
|
||||
{[testenv:pep8]commands}
|
||||
{[testenv:bashate]commands}
|
||||
{[testenv:ansible-lint]commands}
|
||||
{[testenv:ansible-syntax]commands}
|
32
zuul.d/project.yaml
Normal file
32
zuul.d/project.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
# Copyright 2017, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# 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.
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- openstack-ansible-linters
|
||||
- openstack-ansible-functional-centos-7
|
||||
- openstack-ansible-functional-opensuse-423
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
- openstack-ansible-upgrade-ubuntu-xenial
|
||||
experimental:
|
||||
jobs:
|
||||
- openstack-ansible-integrated-deploy-aio
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-ansible-linters
|
||||
- openstack-ansible-functional-centos-7
|
||||
- openstack-ansible-functional-opensuse-423
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
- openstack-ansible-upgrade-ubuntu-xenial
|
Loading…
Reference in New Issue
Block a user