Add basic functional tests to role

This implements the use of the openstack-ansible-tests repo and deploys
magnum, along with dependent services, to exercise basic functional
tests through tempest.

Change-Id: Ib9c986b5abe3f42b663af9981bed43c9aae8036d
This commit is contained in:
Jimmy McCrory
2016-09-28 09:00:59 +01:00
parent ccf66e2659
commit 6f477978b2
17 changed files with 756 additions and 93 deletions

4
.gitignore vendored
View File

@@ -62,10 +62,8 @@ releasenotes/build
# Test temp files
tests/plugins
tests/playbooks
tests/common
tests/test.retry
# Vagrant artifacts
.vagrant

View File

@@ -98,6 +98,7 @@ magnum_requires_pip_packages:
- httplib2
- python-glanceclient
- python-keystoneclient
- pyyaml
- virtualenv
- virtualenv-tools

View File

@@ -30,4 +30,4 @@ export ANSIBLE_SSH_ARGS="-o ControlMaster=no \
-o ForwardAgent=yes"
echo "Run manual functional tests by executing the following:"
echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml -e \"rolename=$(pwd)\""
echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml"

View File

@@ -2,11 +2,75 @@
src: https://git.openstack.org/openstack/openstack-ansible-apt_package_pinning
scm: git
version: master
- name: openstack_openrc
src: https://git.openstack.org/openstack/openstack-ansible-openstack_openrc
scm: git
version: master
- name: pip_install
src: https://git.openstack.org/openstack/openstack-ansible-pip_install
scm: git
version: master
- name: memcached_server
src: https://git.openstack.org/openstack/openstack-ansible-memcached_server
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: openstack_hosts
src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts
scm: git
version: master
- name: galera_client
src: https://git.openstack.org/openstack/openstack-ansible-galera_client
scm: git
version: master
- name: galera_server
src: https://git.openstack.org/openstack/openstack-ansible-galera_server
scm: git
version: master
- name: haproxy_server
src: https://github.com/openstack/openstack-ansible-haproxy_server
scm: git
version: master
- name: rabbitmq_server
src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server
scm: git
version: master
- name: os_keystone
src: https://git.openstack.org/openstack/openstack-ansible-os_keystone
scm: git
version: master
- name: os_glance
src: https://git.openstack.org/openstack/openstack-ansible-os_glance
scm: git
version: master
- name: os_nova
src: https://git.openstack.org/openstack/openstack-ansible-os_nova
scm: git
version: master
- name: etcd # dependency of os_neutron role
scm: git
src: https://github.com/logan2211/ansible-etcd
version: master
- name: os_neutron
src: https://git.openstack.org/openstack/openstack-ansible-os_neutron
scm: git
version: master
- name: os_tempest
src: https://git.openstack.org/openstack/openstack-ansible-os_tempest
scm: git
version: master
- name: os_cinder
src: https://git.openstack.org/openstack/openstack-ansible-os_cinder
scm: git
version: master
- name: os_heat
src: https://git.openstack.org/openstack/openstack-ansible-os_heat
scm: git
version: master

View File

@@ -0,0 +1,37 @@
---
# 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"
tunnel_address:
address: "{{ tunnel_address }}"
bridge: "br-vxlan"
interface: "eth2"
netmask: "255.255.255.0"
type: "veth"
vlan_address:
bridge: "br-vlan"
interface: "eth12"
netmask: null
type: "veth"
physical_host: localhost
properties:
service_name: "{{ inventory_hostname }}"

View File

@@ -0,0 +1,20 @@
---
# 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.1.101
ansible_ssh_host: 10.1.1.101
ansible_become: True
ansible_user: root
tunnel_address: 10.1.2.101

View File

@@ -0,0 +1,29 @@
---
# 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_become: True
ansible_connection: local
ansible_host: 10.1.1.1
ansible_ssh_host: 10.1.1.1
neutron_local_ip: 10.1.2.1
ansible_python_interpreter: "/usr/bin/python2"
bridges:
- name: "br-mgmt"
ip_addr: "10.1.1.1"
- name: "br-vxlan"
ip_addr: "10.1.2.1"
- name: "br-vlan"
ip_addr: "10.1.3.1"
veth_peer: "eth12"

View File

@@ -0,0 +1,21 @@
---
# 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.1.102
ansible_ssh_host: 10.1.1.102
ansible_become: True
ansible_user: root
tunnel_address: 10.1.2.102
neutron_local_ip: 10.1.2.102

View File

@@ -1,2 +1,152 @@
[all]
localhost ansible_connection=local ansible_become=True
localhost
infra1
openstack1
[all_containers]
infra1
openstack1
[rabbitmq_all]
infra1
[galera_all]
infra1
[memcached_all]
infra1
[service_all:children]
rabbitmq_all
galera_all
[keystone_all]
openstack1
[glance_api]
openstack1
[glance_registry]
openstack1
[glance_all:children]
glance_api
glance_registry
[magnum_all]
openstack1
[utility_all]
openstack1
[neutron_agent]
openstack1
[neutron_dhcp_agent]
openstack1
[neutron_linuxbridge_agent]
openstack1
localhost
[neutron_openvswitch_agent]
[neutron_metering_agent]
openstack1
[neutron_l3_agent]
openstack1
[neutron_lbaas_agent]
openstack1
[neutron_metadata_agent]
openstack1
[neutron_server]
openstack1
[neutron_all:children]
neutron_agent
neutron_dhcp_agent
neutron_linuxbridge_agent
neutron_openvswitch_agent
neutron_metering_agent
neutron_l3_agent
neutron_lbaas_agent
neutron_metadata_agent
neutron_server
[nova_api_metadata]
openstack1
[nova_api_os_compute]
openstack1
[nova_cert]
openstack1
[nova_compute]
localhost
[nova_conductor]
openstack1
[nova_console]
openstack1
[nova_scheduler]
openstack1
[nova_all:children]
nova_api_metadata
nova_api_os_compute
nova_cert
nova_compute
nova_conductor
nova_console
nova_scheduler
[heat_all:children]
heat_api
heat_engine
heat_api_cfn
heat_api_cloudwatch
heat_engine_container
heat_apis_container
[heat_api]
openstack1
[heat_engine]
openstack1
[heat_api_cfn]
openstack1
[heat_api_cloudwatch]
openstack1
[heat_engine_container]
openstack1
[heat_apis_container]
openstack1
[cinder_api]
openstack1
[cinder_scheduler]
openstack1
[cinder_backup]
openstack1
[cinder_volume]
localhost
[cinder_all:children]
cinder_api
cinder_scheduler
cinder_backup
cinder_volume

187
tests/magnum-test-vars.yml Normal file
View File

@@ -0,0 +1,187 @@
---
magnum_developer_mode: true
cinder_service_region: RegionOne
magnum_galera_password: secrete
magnum_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}"
magnum_service_password: secrete
magnum_rabbitmq_password: secrete
magnum_trustee_password: secrete
magnum_rabbitmq_servers: "{{ rabbitmq_servers }}"
magnum_rabbitmq_userid: magnum
magnum_rabbitmq_vhost: /magnum
magnum_galera_database_name: magnum_service
magnum_galera_user: magnum
# TODO: Install and use barbican for certificate management
# Override use of barbican
magnum_config_overrides:
certificates:
cert_manager_type: x509keypair
heat_venv_tag: "testing"
heat_developer_mode: true
heat_git_install_branch: master
heat_requirements_git_install_branch: master
heat_service_password: secrete
heat_stack_domain_admin_password: secrete
heat_auth_encryption_key: 32characterslongboguskeyvaluefoo
heat_galera_password: "SuperSecrete"
heat_container_mysql_password: "SuperSecrete"
heat_galera_address: 10.1.1.101
heat_galera_user: heat
heat_galera_database: heat
heat_rabbitmq_servers: 10.1.1.101
heat_rabbitmq_use_ssl: false
heat_rabbitmq_port: 5672
heat_rabbitmq_password: "secrete"
heat_rabbitmq_userid: heat
heat_rabbitmq_vhost: /heat
haproxy_default_services:
- service:
haproxy_service_name: galera
haproxy_backend_nodes: "{{ [groups['galera_all'][0]] | default([]) }}" # list expected
haproxy_backup_nodes: "{{ groups['galera_all'][1:] | default([]) }}"
haproxy_port: 3306
haproxy_balance_type: tcp
haproxy_timeout_client: 5000s
haproxy_timeout_server: 5000s
haproxy_backend_options:
- "mysql-check user {{ galera_monitoring_user }}"
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
- service:
haproxy_service_name: glance_api
haproxy_backend_nodes: "{{ groups['glance_api'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 9292
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk /healthcheck"
- service:
haproxy_service_name: glance_registry
haproxy_backend_nodes: "{{ groups['glance_registry'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 9191
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk /healthcheck"
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
- service:
haproxy_service_name: heat_api_cfn
haproxy_backend_nodes: "{{ groups['heat_api_cfn'] | default([]) }}"
haproxy_port: 8000
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
- service:
haproxy_service_name: heat_api_cloudwatch
haproxy_backend_nodes: "{{ groups['heat_api_cloudwatch'] | default([]) }}"
haproxy_port: 8003
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
- service:
haproxy_service_name: heat_api
haproxy_backend_nodes: "{{ groups['heat_api'] | default([]) }}"
haproxy_port: 8004
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
- service:
haproxy_service_name: keystone_service
haproxy_backend_nodes: "{{ groups['keystone_all'] | default([]) }}"
haproxy_port: 5000
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_balance_type: "http"
haproxy_backend_options:
- "httpchk HEAD /"
- service:
haproxy_service_name: keystone_admin
haproxy_backend_nodes: "{{ groups['keystone_all'] | default([]) }}"
haproxy_port: 35357
haproxy_balance_type: "http"
haproxy_backend_options:
- "httpchk HEAD /"
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
- service:
haproxy_service_name: neutron_server
haproxy_backend_nodes: "{{ groups['neutron_server'] | default([]) }}"
haproxy_port: 9696
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
- service:
haproxy_service_name: nova_api_metadata
haproxy_backend_nodes: "{{ groups['nova_api_metadata'] | default([]) }}"
haproxy_port: 8775
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
- service:
haproxy_service_name: nova_api_os_compute
haproxy_backend_nodes: "{{ groups['nova_api_os_compute'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 8774
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
- service:
haproxy_service_name: nova_console
haproxy_backend_nodes: "{{ groups['nova_console'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 6082
haproxy_balance_type: tcp
haproxy_timeout_client: 60m
haproxy_timeout_server: 60m
haproxy_balance_alg: source
haproxy_backend_options:
- tcp-check
- service:
haproxy_service_name: cinder_api
haproxy_backend_nodes: "{{ groups['cinder_api'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 8776
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
- service:
haproxy_service_name: rabbitmq_mgmt
haproxy_backend_nodes: "{{ groups['rabbitmq'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 15672
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk HEAD /"
haproxy_whitelist_networks:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
- service:
haproxy_service_name: magnum
haproxy_backend_nodes: "{{ groups['magnum_all'] | default([]) }}"
haproxy_ssl: "{{ haproxy_ssl }}"
haproxy_port: 9511
haproxy_balance_type: http
haproxy_backend_options:
- "httpchk GET /"
ssl_cipher_suite: "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS"
haproxy_ssl: false

View File

@@ -0,0 +1,26 @@
---
tempest_main_group: magnum_all
tempest_plugins:
- name: magnum
repo: https://git.openstack.org/openstack/magnum
branch: master
tempest_tempest_conf_overrides:
magnum:
flavor_id: m1.magnum
master_flavor_id: m1.magnum
neutron_provider_networks:
network_types: "vxlan,flat"
network_mappings: "flat:eth12"
network_vxlan_ranges: "1:1000"
external_lb_vip_address: 10.1.1.1
internal_lb_vip_address: 10.1.1.1
test_keystone_host: "{{ external_lb_vip_address }}"
glance_service_publicuri: "http://{{ external_lb_vip_address }}:9292"
test_cinder_api_host: "{{ external_lb_vip_address }}"
nova_service_publicuri: "http://{{ external_lb_vip_address }}:8774"
neutron_service_publicuri: "http://{{ external_lb_vip_address }}:9696"

View File

@@ -0,0 +1,22 @@
---
# 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: Install haproxy
hosts: localhost
roles:
- role: "haproxy_server"
haproxy_service_configs: "{{ haproxy_default_services }}"
vars_files:
- magnum-test-vars.yml

View File

@@ -0,0 +1,32 @@
---
# 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: Deploy heat
hosts: heat_all
user: root
gather_facts: true
pre_tasks:
- include: common/ensure-rabbitmq.yml
vhost_name: "{{ heat_rabbitmq_vhost }}"
user_name: "{{ heat_rabbitmq_userid }}"
user_password: "{{ heat_rabbitmq_password }}"
- include: common/create-grant-db.yml
db_name: "{{ heat_galera_database }}"
db_password: "{{ heat_galera_password }}"
roles:
- role: os_heat
vars_files:
- common/test-vars.yml
- magnum-test-vars.yml

View File

@@ -0,0 +1,32 @@
---
# Copyright 2016, Catalyst IT Limited
#
# 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: Install magnum server
hosts: magnum_all
user: root
pre_tasks:
- include: common/ensure-rabbitmq.yml
vhost_name: "{{ magnum_rabbitmq_vhost }}"
user_name: "{{ magnum_rabbitmq_userid }}"
user_password: "{{ magnum_rabbitmq_password }}"
- include: common/create-grant-db.yml
db_user: "{{ magnum_galera_user }}"
db_name: "{{ magnum_galera_database_name }}"
db_password: "{{ magnum_galera_password }}"
roles:
- role: "os_magnum"
vars_files:
- common/test-vars.yml
- magnum-test-vars.yml

View File

@@ -0,0 +1,65 @@
---
# 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: Playbook for functional testing of magnum
hosts: magnum_all
user: root
gather_facts: false
pre_tasks:
- name: Install testing pip packages
pip:
name: "python-openstackclient"
# using the glance library with a large image sometimes results in an incomplete image
# this should be more reliable
- name: Download magnum fedora-atomic-latest image
get_url:
url: "https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2"
dest: "/var/tmp/fedora-atomic-latest.qcow2"
register: image_download
- name: Upload magnum fedora-atomic-latest image to glance
shell: |
. /root/openrc
openstack image create \
--disk-format=qcow2 \
--container-format=bare \
--file=/var/tmp/fedora-atomic-latest.qcow2 \
--property os_distro='fedora-atomic' \
--public \
fedora-atomic-latest
when: image_download | changed
# a flavor with a larger disk size is required for the magnum image
- name: Check if m1.magnum flavor 100 exists
shell: |
. /root/openrc
nova flavor-show m1.magnum
register: m1magnum
failed_when: False
changed_when: m1magnum.rc != 0
- name: Create m1.magnum flavor 100
shell: |
. /root/openrc
nova flavor-create m1.magnum 100 1024 10 1
when:
- m1magnum.rc != 0
tasks:
- name: Run tempest
shell: |
. {{ tempest_venv_bin }}/activate
{{ tempest_venv_bin | dirname }}/run_tempest.sh --no-virtual-env ${RUN_TEMPEST_OPTS} magnum.tests.functional.api
environment:
RUN_TEMPEST_OPTS: "--serial"
vars_files:
- common/test-vars.yml
- magnum-test-vars.yml

View File

@@ -1,5 +1,6 @@
---
# Copyright 2016, Catalyst IT Limited
# 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.
@@ -13,15 +14,47 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install magnum server
hosts: magnum_all
user: root
roles:
- role: "{{ rolename | basename }}"
vars:
external_lb_vip_address: 172.16.24.1
internal_lb_vip_address: 192.168.0.1
magnum_galera_address: "{{ internal_lb_vip_address }}"
keystone_admin_user_name: admin
keystone_admin_tenant_name: admin
keystone_auth_admin_password: "SuperSecretePassword"
# Prepare the hosts
- include: common/test-setup-host.yml
# Install haproxy
- include: test-install-haproxy.yml
# Prepare the cinder-volumes VG
- include: common/test-setup-cinder-localhost.yml
# Install memcached
- include: common/test-install-memcached.yml
# Install galera
- include: common/test-install-galera.yml
# Install rabbitmq
- include: common/test-install-rabbitmq.yml
# Install keystone
- include: common/test-install-keystone.yml
# Install glance
- include: common/test-install-glance.yml
# Install cinder
- include: common/test-install-cinder.yml
# Install nova
- include: common/test-install-nova.yml
# Install neutron
- include: common/test-install-neutron.yml
# Install heat
- include: test-install-heat.yml
# Install magnum
- include: test-install-magnum.yml
# Install tempest
- include: common/test-install-tempest.yml
# Test magnum
- include: test-magnum-functional.yml

98
tox.ini
View File

@@ -22,13 +22,11 @@ passenv =
NO_PROXY
whitelist_externals =
bash
echo
git
rm
wget
setenv =
VIRTUAL_ENV={envdir}
PYTHONUNBUFFERED=1
ROLE_NAME=os_magnum
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
[testenv:docs]
@@ -54,17 +52,17 @@ commands =
{posargs}
[testenv:tests_clone]
commands =
bash -c "if [ ! -d "{toxinidir}/tests/common" ]; then \
git clone https://git.openstack.org/openstack/openstack-ansible-tests {toxinidir}/tests/common; \
fi"
[testenv:pep8]
commands =
# Run hacking/flake8 check for all python files
bash -c "grep --recursive --binary-files=without-match \
--files-with-match '^.!.*python$' \
--exclude-dir .eggs \
--exclude-dir .git \
--exclude-dir .tox \
--exclude-dir *.egg-info \
--exclude-dir doc \
{toxinidir} | xargs flake8 --verbose"
{[testenv:tests_clone]commands}
bash -c "{toxinidir}/tests/common/test-pep8.sh"
[flake8]
@@ -77,65 +75,27 @@ ignore=F403,H303
[testenv:bashate]
commands =
# Run bashate check for all bash scripts
# Ignores the following rules:
# E003: Indent not multiple of 4 (we prefer to use multiples of 2)
# E006: Line longer than 79 columns (as many scripts use jinja
# templating, this is very difficult)
# E040: Syntax error determined using `bash -n` (as many scripts
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)
bash -c "grep --recursive --binary-files=without-match \
--files-with-match '^.!.*\(ba\)\?sh$' \
--exclude-dir .tox \
--exclude-dir .git \
{toxinidir} | xargs bashate --error . --verbose --ignore=E003,E006,E040"
{[testenv:tests_clone]commands}
bash -c "{toxinidir}/tests/common/test-bashate.sh"
[testenv:ansible]
deps =
{[testenv]deps}
ansible==2.1.1
ansible-lint>=2.7.0,<3.0.0
setenv =
{[testenv]setenv}
ANSIBLE_HOST_KEY_CHECKING = False
ANSIBLE_SSH_CONTROL_PATH = /tmp/%%h-%%r
# TODO (odyssey4me) These are only here as they are non-standard folder
# names for Ansible 1.9.x. We are using the standard folder names for
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
ANSIBLE_ACTION_PLUGINS = {homedir}/.ansible/plugins/action
ANSIBLE_CALLBACK_PLUGINS = {homedir}/.ansible/plugins/callback
ANSIBLE_FILTER_PLUGINS = {homedir}/.ansible/plugins/filter
ANSIBLE_LOOKUP_PLUGINS = {homedir}/.ansible/plugins/lookup
# This is required as the default is the current path or a path specified
# in ansible.cfg
ANSIBLE_LIBRARY = {homedir}/.ansible/plugins/library
# This is required as the default is '/etc/ansible/roles' or a path
# specified in ansible.cfg
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
ANSIBLE_TRANSPORT = "ssh"
-rhttp://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt
commands =
rm -rf {homedir}/.ansible/plugins
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
{homedir}/.ansible/plugins
rm -rf {homedir}/.ansible/roles
ansible-galaxy install \
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
--force
{[testenv:tests_clone]commands}
bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh"
[testenv:ansible-syntax]
deps =
{[testenv:ansible]deps}
setenv =
{[testenv:ansible]setenv}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \
--syntax-check \
--list-tasks \
-e "rolename={toxinidir}" \
{toxinidir}/tests/test.yml
@@ -157,10 +117,7 @@ install_command =
[testenv:func_logs]
commands =
bash -c 'mkdir -p {toxinidir}/logs'
bash -c 'rsync --archive --verbose --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true'
bash -c 'find "{toxinidir}/logs/" -type f | sed "p;s|$|.txt|" | xargs -n2 mv'
bash -c 'command gzip --best --recursive "{toxinidir}/logs/"'
bash -c "{toxinidir}/tests/common/test-log-collect.sh"
[testenv:functional]
@@ -176,28 +133,17 @@ install_command =
{[testenv:func_base]install_command}
deps =
{[testenv:ansible]deps}
setenv =
{[testenv:ansible]setenv}
commands =
echo -e "\n *******************************************************\n" \
"**** Functional Testing is still to be implemented ****\n" \
"**** TODO: Write tests here ****\n" \
"*******************************************************\n"
# As a temporary measure, while functional testing is being worked on, we
# will not execute the functional test. This allows other patches to be
# worked on while the functional testing is being worked out.
#{[testenv:ansible]commands}
#ansible-playbook -i {toxinidir}/tests/inventory \
# -e "rolename={toxinidir}" \
# {toxinidir}/tests/test.yml -vvvv
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \
-e @{toxinidir}/tests/os_magnum-overrides.yml \
{toxinidir}/tests/test.yml -vvvv
{[testenv:func_logs]commands}
[testenv:linters]
deps =
{[testenv:ansible]deps}
setenv =
{[testenv:ansible]setenv}
commands =
{[testenv:pep8]commands}
{[testenv:bashate]commands}