Fill the tests directory

The tests directory is needed to pass the gates

Change-Id: I647d7487177a046120e5f7f43adf48e2aa821f8a
Signed-off-by: Manuel Buil <mbuil@suse.com>
This commit is contained in:
Manuel Buil 2017-08-03 13:48:31 +02:00
parent 3a0f3ec810
commit b873fcd409
13 changed files with 344 additions and 28 deletions

View File

@ -135,7 +135,7 @@ heat_service_adminurl: "{{ tacker_service_publicuri_proto }}://{{ external_lb_vi
#NOTE: these default should be updated approprietly
# tacker-horizon uses this
tackerclient_git_url: https://github.com/openstack/python-tackerclient.git
tacker_git_branch: "stable/liberty"
tacker_git_branch: "master"
# tacker horizon vars
tacker_horizon_venv: "/openstack/venvs/horizon-{{ openstack_release }}"

View File

@ -410,7 +410,7 @@ default_vim = VIM0
#openstack = /etc/tacker/vim/fernet_keys
[tacker_nova]
# parameters for novaclient to talk to nova
region_name = {{ service_region }}
region_name = {{ tacker_service_region }}
project_domain_id = {{ nova_service_project_domain_id }}
project_name = {{ nova_service_project_name }}
user_domain_id = {{ nova_service_user_domain_id }}

View File

@ -0,0 +1,26 @@
---
# 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.
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 }}"

View File

@ -0,0 +1,18 @@
---
# 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.
ansible_host: 10.1.0.2
ansible_become: True
ansible_user: root

View 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"

View File

@ -0,0 +1,18 @@
---
# Copyright 2017, SUSE Linux GmbH
#
# 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

View File

@ -1 +1,34 @@
localhost
[all]
localhost
infra1
tacker1
[all_containers]
infra1
tacker1
[rabbitmq_all]
infra1
[galera_all]
infra1
[memcached_all]
infra1
[service_all:children]
rabbitmq_all
galera_all
memcached_all
[keystone_all]
infra1
[tacker_all]
tacker1
[utility_all]
tacker1
[tacker_all]
tacker1

View File

@ -0,0 +1,30 @@
---
# Copyright 2017, SUSE LINUX GmbH
#
# 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.
tacker_service_tenant_name: service
tacker_rabbitmq_port: "{{ rabbitmq_port }}"
tacker_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
tacker_rabbitmq_servers: "{{ rabbitmq_servers }}"
tacker_rabbitmq_host_group: "{{ rabbitmq_host_group }}"
tacker_service_publicuri: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}"
tacker_service_adminurl: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}"
tacker_service_adminuri: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}"
tacker_aodh_enabled: false
tacker_gnocchi_enabled: false
tacker_rabbitmq_password: "secrete"
tacker_service_password: "secrete"
tacker_container_mysql_password: "secrete"
tacker_developer_mode: true
tacker_galera_address: "{{ test_galera_host }}"

View File

@ -0,0 +1,34 @@
---
# Copyright 2017, SUSE Linux GmbH
#
# 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: Playbook for deploying tacker
hosts: tacker_all
user: root
become: true
gather_facts: true
any_errors_fatal: true
pre_tasks:
- include: common/ensure-rabbitmq.yml
vhost_name: "{{ tacker_rabbitmq_vhost }}"
user_name: "{{ tacker_rabbitmq_userid }}"
user_password: "{{ tacker_rabbitmq_password }}"
when: "{{ groups['rabbitmq_all'] is defined }}"
- include: common/create-grant-db.yml
db_name: "{{ tacker_galera_database }}"
db_password: "{{ tacker_container_mysql_password }}"
roles:
- role: os_tacker
vars_files:
- common/test-vars.yml

View File

@ -0,0 +1,30 @@
---
# 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.
- name: Ensure tacker APIs are reachable
hosts: tacker_all
user: root
gather_facts: false
tasks:
- name: check tacker api
uri:
url: "http://localhost:{{ item }}"
status_code: 200
register: result
until: result.status == 200
retries: 5
delay: 10
with_items:
- 8888

View File

@ -1,5 +1,29 @@
---
- hosts: localhost
remote_user: root
roles:
- os_tacker
# Copyright 2017, SUSE Linux GmbH
#
# 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 RabbitMQ/MariaDB
- include: common/test-install-infra.yml
# Install Keystone
- include: common/test-install-keystone.yml
# Install Tacker
- include: test-install-tacker.yml
# Test Tacker
- include: test-tacker-functional.yml

99
tests/tests-repo-clone.sh Executable file
View File

@ -0,0 +1,99 @@
#!/bin/bash
# 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.
# 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.
# WARNING:
# This file is maintained in the openstack-ansible-tests repository:
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests
# If you need to change this script, then propose the change there.
# Once it merges, the change will be replicated to the other repositories.
## Shell Opts ----------------------------------------------------------------
set -e
## Vars ----------------------------------------------------------------------
export TESTING_HOME=${TESTING_HOME:-$HOME}
export WORKING_DIR=${WORKING_DIR:-$(pwd)}
export CLONE_UPGRADE_TESTS=${CLONE_UPGRADE_TESTS:-no}
## Functions -----------------------------------------------------------------
function create_tests_clonemap {
# Prepare the clonemap for zuul-cloner to use
cat > ${TESTING_HOME}/tests-clonemap.yaml << EOF
clonemap:
- name: openstack/openstack-ansible-tests
dest: ${WORKING_DIR}/tests/common
EOF
}
## Main ----------------------------------------------------------------------
# If zuul-cloner is present, use it so that we
# also include any dependent patches from the
# tests repo noted in the commit message.
if [[ -x /usr/zuul-env/bin/zuul-cloner ]]; then
# Prepare the clonemap for zuul-cloner to use
create_tests_clonemap
# Execute the clone
/usr/zuul-env/bin/zuul-cloner \
--cache-dir /opt/git \
--map ${TESTING_HOME}/tests-clonemap.yaml \
git://git.openstack.org \
openstack/openstack-ansible-tests
# Clean up the clonemap.
rm -f ${TESTING_HOME}/tests-clonemap.yaml
# Alternatively, use a simple git-clone. We do
# not re-clone if the directory exists already
# to prevent overwriting any local changes which
# may have been made.
elif [[ ! -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 \
${WORKING_DIR}/tests/common
fi
fi
# If this test set includes an upgrade test, the
# previous stable release tests repo must also be
# cloned.
# Note:
# Dependent patches to the previous stable release
# tests repo are not supported.
if [[ "${CLONE_UPGRADE_TESTS}" == "yes" ]]; then
if [[ ! -d "${WORKING_DIR}/tests/common/previous" ]]; then
git clone -b stable/ocata \
https://git.openstack.org/openstack/openstack-ansible-tests \
${WORKING_DIR}/tests/common/previous
fi
fi

27
tox.ini
View File

@ -119,27 +119,12 @@ install_command =
commands =
bash -c "{toxinidir}/tests/common/test-log-collect.sh"
# TODO(mbuil): Add functional testing
#[testenv:functional]
## Ignore_errors is set to true so that the logs are collected at the
## end of the run. This will not produce a false positive. Any
## exception will be mark the run as failed and exit 1 after all of
## the commands have been iterated through.
#ignore_errors = True
## NOTE(odyssey4me): this target does not use constraints because
## it doesn't work in OpenStack-CI yet. Once that's fixed, we can
## drop the install_command.
#install_command =
# {[testenv:func_base]install_command}
#deps =
# {[testenv:ansible]deps}
#commands =
# {[testenv:ansible]commands}
# ansible-playbook -i {toxinidir}/tests/inventory \
# -e "install_test_packages=True" \
# {toxinidir}/tests/test.yml -vvvv
# {[testenv:func_logs]commands}
[testenv:functional]
deps =
{[testenv:ansible]deps}
commands =
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:linters]
deps =