Ansible 2.1.1 role testing

Change-Id: I36c72b4930dceb730371290461c5cdd1c22b70ea
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Travis Truman 2016-08-10 11:44:52 -04:00
parent 1f682b09ef
commit 09185c5bbd
16 changed files with 121 additions and 328 deletions

7
.gitignore vendored
View File

@ -29,6 +29,7 @@ doc/build/
*.log *.log
*.sql *.sql
*.sqlite *.sqlite
logs/*
# OS generated files # # OS generated files #
###################### ######################
@ -61,6 +62,10 @@ releasenotes/build
# Test temp files # Test temp files
tests/plugins tests/plugins
tests/playbooks
tests/test.retry
# Vagrant testing artifacts # Vagrant artifacts
.vagrant .vagrant

View File

@ -18,5 +18,16 @@ export ANSIBLE_LIBRARY=${HOME}/.ansible/plugins/library
# specified in ansible.cfg # specified in ansible.cfg
export ANSIBLE_ROLES_PATH=${HOME}/.ansible/roles:$(pwd)/.. export ANSIBLE_ROLES_PATH=${HOME}/.ansible/roles:$(pwd)/..
export ANSIBLE_SSH_ARGS="-o ControlMaster=no \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-o ServerAliveInterval=64 \
-o ServerAliveCountMax=1024 \
-o Compression=no \
-o TCPKeepAlive=yes \
-o VerifyHostKeyDNS=no \
-o ForwardX11=no \
-o ForwardAgent=yes"
echo "Run manual functional tests by executing the following:" 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 -e \"rolename=$(pwd)\""

View File

@ -24,23 +24,23 @@ if [ ! "$(which pip)" ]; then
fi fi
# Install bindep and tox # Install bindep and tox
pip install bindep tox sudo pip install bindep tox
# CentOS 7 requires two additional packages: # CentOS 7 requires two additional packages:
# redhat-lsb-core - for bindep profile support # redhat-lsb-core - for bindep profile support
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1 # epel-release - required to install python-ndg_httpsclient/python2-pyasn1
if [ "$(which yum)" ]; then if [ "$(which yum)" ]; then
yum -y install redhat-lsb-core epel-release sudo yum -y install redhat-lsb-core epel-release
fi fi
# Install OS packages using bindep # Install OS packages using bindep
if apt-get -v >/dev/null 2>&1 ; then if apt-get -v >/dev/null 2>&1 ; then
apt-get update sudo apt-get update
DEBIAN_FRONTEND=noninteractive \ DEBIAN_FRONTEND=noninteractive \
apt-get -q --option "Dpkg::Options::=--force-confold" \ sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install `bindep -b -f bindep.txt test` --assume-yes install `bindep -b -f bindep.txt test`
else else
yum install -y `bindep -b -f bindep.txt test` sudo yum install -y `bindep -b -f bindep.txt test`
fi fi
# run through each tox env and execute the test # run through each tox env and execute the test

View File

@ -13,14 +13,13 @@
# 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.
ansible_ssh_host: "{{ ansible_host }}"
container_name: "{{ inventory_hostname }}" container_name: "{{ inventory_hostname }}"
container_networks: container_networks:
management_address: management_address:
address: "{{ ansible_host }}" address: "{{ ansible_host }}"
bridge: "lxcbr0" bridge: "br-mgmt"
interface: "eth1" interface: "eth1"
netmask: "255.255.252.0" netmask: "255.255.255.0"
type: "veth" type: "veth"
physical_host: localhost physical_host: localhost
properties: properties:

View File

@ -1,5 +1,5 @@
--- ---
# Copyright 2015, Rackspace US, Inc. # Copyright 2016, Rackspace US, Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -13,11 +13,7 @@
# 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.
- name: Playbook for deploying tempest bridges:
hosts: horizon_all - "br-mgmt"
user: root
gather_facts: true ansible_python_interpreter: "/usr/bin/python2"
roles:
- role: "os_tempest"
vars_files:
- test-vars.yml

View File

@ -1,5 +1,5 @@
[all] [all]
localhost ansible_connection=local ansible_become=True localhost ansible_become=True
infra1 ansible_host=10.100.100.2 ansible_become=True ansible_user=root infra1 ansible_host=10.100.100.2 ansible_become=True ansible_user=root
keystone1 ansible_host=10.100.100.3 ansible_become=True ansible_user=root keystone1 ansible_host=10.100.100.3 ansible_become=True ansible_user=root
horizon1 ansible_host=10.100.100.4 ansible_become=True ansible_user=root horizon1 ansible_host=10.100.100.4 ansible_become=True ansible_user=root
@ -15,12 +15,19 @@ infra1
[galera_all] [galera_all]
infra1 infra1
[memcached_all]
infra1
[service_all:children] [service_all:children]
rabbitmq_all rabbitmq_all
galera_all galera_all
memcached_all
[keystone_all] [keystone_all]
keystone1 keystone1
[utility_all]
keystone1
[horizon_all] [horizon_all]
horizon1 horizon1

View File

@ -57,11 +57,19 @@
until: add_service|success until: add_service|success
retries: 5 retries: 5
delay: 10 delay: 10
vars_files:
- playbooks/test-vars.yml
- test-vars.yml
- name: Playbook for tempest testing of horizon
hosts: utility_all
user: root
gather_facts: false
tasks:
- name: Run tempest - name: Run tempest
shell: | shell: |
. {{ tempest_bin }}/activate . {{ tempest_bin }}/activate
{{ tempest_bin | dirname }}/run_tempest.sh --no-virtual-env ${RUN_TEMPEST_OPTS} tempest_horizon.tests.scenario.test_dashboard_basic_ops.TestDashboardBasicOps {{ tempest_bin | dirname }}/run_tempest.sh --no-virtual-env --serial tempest_horizon.tests.scenario.test_dashboard_basic_ops.TestDashboardBasicOps
environment:
RUN_TEMPEST_OPTS: "--serial"
vars_files: vars_files:
- playbooks/test-vars.yml
- test-vars.yml - test-vars.yml

View File

@ -17,7 +17,33 @@
hosts: horizon_all hosts: horizon_all
user: root user: root
gather_facts: true gather_facts: true
pre_tasks:
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "localhost"
name: "{{ horizon_galera_database }}"
state: "present"
when: inventory_hostname == groups['horizon_all'][0]
delegate_to: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}"
- name: Grant access to the DB for the service
mysql_user:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "localhost"
name: "{{ horizon_galera_database }}"
password: "{{ horizon_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ horizon_galera_database }}.*:ALL"
with_items:
- "localhost"
- "%"
when: inventory_hostname == groups['horizon_all'][0]
delegate_to: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}"
roles: roles:
- role: "{{ rolename | basename }}" - role: "os_horizon"
vars_files: vars_files:
- playbooks/test-vars.yml
- test-vars.yml - test-vars.yml

View File

@ -1,57 +0,0 @@
---
# 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.
- name: Playbook for deploying infra services
hosts: service_all
user: root
gather_facts: true
roles:
- role: "rabbitmq_server"
rabbitmq_cookie_token: secrete
- role: "galera_server"
galera_root_password: secrete
galera_root_user: root
galera_innodb_buffer_pool_size: 512M
galera_innodb_log_buffer_size: 32M
galera_server_id: "{{ inventory_hostname | string_2_int }}"
galera_wsrep_node_name: "{{ inventory_hostname }}"
galera_wsrep_provider_options:
- { option: "gcache.size", value: "32M" }
galera_server_id: "{{ inventory_hostname | string_2_int }}"
post_tasks:
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "127.0.0.1"
name: "{{ horizon_galera_database }}"
state: "present"
when: inventory_hostname == groups['service_all'][0]
- name: Grant access to the DB for the service
mysql_user:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "127.0.0.1"
name: "{{ horizon_galera_user }}"
password: "{{ horizon_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ horizon_galera_database }}.*:ALL"
with_items:
- "localhost"
- "%"
when: inventory_hostname == groups['service_all'][0]
vars_files:
- test-vars.yml

View File

@ -1,65 +0,0 @@
---
# 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.
- name: Playbook for deploying keystone
hosts: keystone_all
user: root
gather_facts: true
pre_tasks:
- name: Ensure rabbitmq vhost
rabbitmq_vhost:
name: "{{ keystone_rabbitmq_vhost }}"
state: "present"
delegate_to: "10.100.100.2"
when: inventory_hostname == groups['keystone_all'][0]
- name: Ensure rabbitmq user
rabbitmq_user:
user: "{{ keystone_rabbitmq_userid }}"
password: "{{ keystone_rabbitmq_password }}"
vhost: "{{ keystone_rabbitmq_vhost }}"
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
state: "present"
delegate_to: "10.100.100.2"
when: inventory_hostname == groups['keystone_all'][0]
- name: Create DB for service
mysql_db:
login_user: "root"
login_password: "secrete"
login_host: "localhost"
name: "{{ keystone_galera_database }}"
state: "present"
delegate_to: "10.100.100.2"
when: inventory_hostname == groups['keystone_all'][0]
- name: Grant access to the DB for the service
mysql_user:
login_user: "root"
login_password: "secrete"
login_host: "localhost"
name: "{{ keystone_galera_database }}"
password: "{{ keystone_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ keystone_galera_database }}.*:ALL"
with_items:
- "localhost"
- "%"
delegate_to: "10.100.100.2"
when: inventory_hostname == groups['keystone_all'][0]
roles:
- role: os_keystone
vars_files:
- test-vars.yml

View File

@ -1,33 +0,0 @@
---
# 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.
- name: Playbook for creating containers
hosts: all_containers
connection: local
gather_facts: false
roles:
- role: "lxc_container_create"
lxc_container_release: trusty
lxc_container_backing_store: dir
global_environment_variables:
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
post_tasks:
- name: Wait for ssh to be available
local_action:
module: wait_for
port: "{{ ansible_ssh_port | default('22') }}"
host: "{{ ansible_ssh_host | default(inventory_hostname) }}"
search_regex: OpenSSH
delay: 1

View File

@ -1,46 +0,0 @@
---
# 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.
- name: Playbook for configuring LXC host
hosts: localhost
pre_tasks:
# Make sure OS does not have a stale package cache.
- name: Update apt cache
apt:
update_cache: yes
when: ansible_os_family == 'Debian'
- name: Ensure root's new public ssh key is in authorized_keys
authorized_key:
user: root
key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
manage_dir: no
- set_fact:
lxc_container_ssh_key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
- name: Check if this is an OpenStack-CI nodepool instance
stat:
path: /etc/nodepool/provider
register: nodepool
- name: Set the files to copy into the container cache for OpenStack-CI instances
set_fact:
lxc_container_cache_files:
- { src: '/etc/pip.conf', dest: '/etc/pip.conf' }
when: nodepool.stat.exists | bool
roles:
- role: "lxc_hosts"
lxc_net_address: 10.100.100.1
lxc_net_dhcp_range: 10.100.100.8,10.100.100.253
lxc_net_bridge: lxcbr0
lxc_kernel_options:
- { key: 'fs.inotify.max_user_instances', value: 1024 }

View File

@ -1,33 +0,0 @@
---
# 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.
# NOTE: we use become_user because setting become: no or become: false
# doesn't seem to override the ansible_become=true in the
# inventory
- name: Playbook for establishing ssh keys
hosts: localhost
become_user: "{{ ansible_ssh_user }}"
pre_tasks:
- name: Create ssh key pair for root
user:
name: "{{ ansible_ssh_user }}"
generate_ssh_key: "yes"
ssh_key_bits: 2048
ssh_key_file: ".ssh/id_rsa"
- name: Get the calling user's key
command: cat ~/.ssh/id_rsa.pub
register: key_get
- set_fact:
lxc_container_ssh_key: "{{ key_get.stdout }}"

View File

@ -13,15 +13,11 @@
# 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.
external_lb_vip_address: 10.100.100.3
galera_client_drop_config_file: false
galera_root_password: "secrete"
galera_root_user: "root"
horizon_developer_mode: true horizon_developer_mode: true
horizon_venv_tag: "testing" horizon_venv_tag: "testing"
horizon_git_install_branch: master horizon_git_install_branch: master
horizon_requirements_git_install_branch: master horizon_requirements_git_install_branch: master
horizon_galera_address: 10.100.100.2 horizon_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}"
horizon_galera_database: dash horizon_galera_database: dash
horizon_galera_user: dash horizon_galera_user: dash
horizon_rabbitmq_password: "secrete" horizon_rabbitmq_password: "secrete"
@ -29,35 +25,11 @@ horizon_rabbitmq_userid: horizon
horizon_rabbitmq_vhost: /horizon horizon_rabbitmq_vhost: /horizon
horizon_container_mysql_password: "SuperSecrete" horizon_container_mysql_password: "SuperSecrete"
horizon_secret_key: "SuperSecreteHorizonKey" horizon_secret_key: "SuperSecreteHorizonKey"
horizon_external_ssl: false horizon_external_ssl: False
horizon_ssl_protocol: "ALL -SSLv2 -SSLv3" horizon_ssl_protocol: "ALL -SSLv2 -SSLv3"
horizon_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" horizon_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"
internal_lb_vip_address: 10.100.100.3
keystone_admin_tenant_name: admin # User for nova service registration required for Horizon tempest tests
keystone_admin_user_name: admin
keystone_auth_admin_password: "SuperSecretePassword"
keystone_container_mysql_password: "SuperSecrete"
keystone_developer_mode: true
keystone_galera_address: 10.100.100.2
keystone_galera_database: keystone
keystone_git_install_branch: master
keystone_rabbitmq_password: "secrete"
keystone_rabbitmq_port: 5671
keystone_rabbitmq_servers: 10.100.100.2
keystone_rabbitmq_use_ssl: true
keystone_rabbitmq_userid: keystone
keystone_rabbitmq_vhost: /keystone
keystone_requirements_git_install_branch: master
keystone_service_adminuri: "http://{{ internal_lb_vip_address }}:35357"
keystone_service_adminuri_insecure: false
keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3"
keystone_service_internaluri: "http://{{ internal_lb_vip_address }}:5000"
keystone_service_internaluri_insecure: false
keystone_service_internalurl: "{{ keystone_service_internaluri }}/v3"
keystone_service_password: "secrete"
keystone_venv_tag: "testing"
memcached_encryption_key: "secrete"
memcached_servers: 127.0.0.1
nova_service_name: nova nova_service_name: nova
nova_service_type: compute nova_service_type: compute
nova_service_description: "Nova Compute Service" nova_service_description: "Nova Compute Service"
@ -70,31 +42,22 @@ nova_service_adminuri: "{{ nova_service_proto }}://{{ internal_lb_vip_address }}
nova_service_adminurl: "{{ nova_service_adminuri }}/v2.1/%(tenant_id)s" nova_service_adminurl: "{{ nova_service_adminuri }}/v2.1/%(tenant_id)s"
nova_service_internaluri: "{{ nova_service_proto }}://{{ internal_lb_vip_address }}:{{ nova_service_port }}" nova_service_internaluri: "{{ nova_service_proto }}://{{ internal_lb_vip_address }}:{{ nova_service_port }}"
nova_service_internalurl: "{{ nova_service_internaluri }}/v2.1/%(tenant_id)s" nova_service_internalurl: "{{ nova_service_internaluri }}/v2.1/%(tenant_id)s"
openrc_os_auth_url: "http://127.0.0.1:5000/v3"
openrc_os_domain_name: "Default" tempest_dashboard_login_url: "https://{{ hostvars[groups['horizon_all'][0]]['ansible_host'] }}/auth/login/"
openrc_os_password: "{{ keystone_auth_admin_password }}" tempest_dashboard_url: "https://{{ hostvars[groups['horizon_all'][0]]['ansible_host'] }}/"
tempest_dashboard_login_url: "https://{{ ansible_hostname }}/auth/login/"
tempest_dashboard_url: "https://{{ ansible_hostname }}/"
tempest_developer_mode: True
tempest_git_install_branch: master
tempest_venv_tag: "{{ tempest_git_install_branch }}" tempest_venv_tag: "{{ tempest_git_install_branch }}"
# tempest_bin is the same as the default in os_tempest role, but we set # tempest_bin is the same as the default in os_tempest role, but we set
# it again here so we can refer to it in test-horizon-functional.yml # it again here so we can refer to it in test-horizon-functional.yml
tempest_bin: "/opt/tempest_{{ tempest_venv_tag }}/bin" tempest_bin: "/opt/tempest_{{ tempest_venv_tag }}/bin"
tempest_log_dir: "/var/log/"
tempest_main_group: horizon_all
tempest_service_available_aodh: False
tempest_service_available_ceilometer: False
tempest_service_available_cinder: False
tempest_service_available_glance: False
tempest_service_available_heat: False
tempest_service_available_horizon: True
tempest_service_available_neutron: False
tempest_service_available_nova: False
tempest_service_available_swift: False
tempest_plugins: tempest_plugins:
- name: tempest-horizon - name: tempest-horizon
repo: https://git.openstack.org/openstack/tempest-horizon repo: https://github.com/trumant/tempest-horizon
branch: master branch: toggle_cert_validation
tempest_tempest_conf_overrides:
dashboard:
disable_ssl_certificate_validation: True
horizon_config_overrides: horizon_config_overrides:
X_TEST_OPTION: True X_TEST_OPTION: True

View File

@ -13,26 +13,20 @@
# 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.
# Prepare the user ssh keys # Setup the host
- include: test-prepare-keys.yml - include: playbooks/test-setup-host.yml
# Prepare the host
- include: test-prepare-host.yml
# Prepare the containers
- include: test-prepare-containers.yml
# Install RabbitMQ/MariaDB # Install RabbitMQ/MariaDB
- include: test-install-infra.yml - include: playbooks/test-install-infra.yml
# Install Keystone # Install Keystone
- include: test-install-keystone.yml - include: playbooks/test-install-keystone.yml
# Install Horizon # Install Horizon
- include: test-install-horizon.yml - include: test-install-horizon.yml
# Install Tempest # Install Tempest
- include: test-install-tempest.yml - include: playbooks/test-install-tempest.yml
# Test Horizon # Test Horizon
- include: test-horizon-functional.yml - include: test-horizon-functional.yml

34
tox.ini
View File

@ -97,7 +97,7 @@ commands =
[testenv:ansible] [testenv:ansible]
deps = deps =
{[testenv]deps} {[testenv]deps}
ansible==1.9.4 ansible==2.1.1
ansible-lint>=2.7.0,<3.0.0 ansible-lint>=2.7.0,<3.0.0
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
@ -116,6 +116,7 @@ setenv =
# This is required as the default is '/etc/ansible/roles' or a path # This is required as the default is '/etc/ansible/roles' or a path
# specified in ansible.cfg # specified in ansible.cfg
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/.. ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
ANSIBLE_TRANSPORT = "ssh"
commands = commands =
rm -rf {homedir}/.ansible/plugins rm -rf {homedir}/.ansible/plugins
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \ git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
@ -124,6 +125,11 @@ commands =
ansible-galaxy install \ ansible-galaxy install \
--role-file={toxinidir}/tests/ansible-role-requirements.yml \ --role-file={toxinidir}/tests/ansible-role-requirements.yml \
--force --force
rm -rf {homedir}/.ansible/roles/os_horizon
bash -c "ln -s {toxinidir} {homedir}/.ansible/roles/os_horizon"
rm -rf {toxinidir}/tests/playbooks
git clone https://git.openstack.org/openstack/openstack-ansible-tests \
{toxinidir}/tests/playbooks
[testenv:ansible-syntax] [testenv:ansible-syntax]
@ -136,7 +142,6 @@ commands =
ansible-playbook -i {toxinidir}/tests/inventory \ ansible-playbook -i {toxinidir}/tests/inventory \
--syntax-check \ --syntax-check \
--list-tasks \ --list-tasks \
-e "rolename={toxinidir}" \
{toxinidir}/tests/test.yml {toxinidir}/tests/test.yml
@ -148,6 +153,22 @@ commands =
ansible-lint {toxinidir} ansible-lint {toxinidir}
[testenv:func_base]
# 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 =
pip install -U --force-reinstall {opts} {packages}
[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/"'
[testenv:functional] [testenv:functional]
# Ignore_errors is set to true so that the logs are collected at the # 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 # end of the run. This will not produce a false positive. Any
@ -158,7 +179,7 @@ ignore_errors = True
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can # it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command. # drop the install_command.
install_command = install_command =
pip install -U --force-reinstall {opts} {packages} {[testenv:func_base]install_command}
deps = deps =
{[testenv:ansible]deps} {[testenv:ansible]deps}
setenv = setenv =
@ -166,13 +187,10 @@ setenv =
commands = commands =
{[testenv:ansible]commands} {[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \ ansible-playbook -i {toxinidir}/tests/inventory \
-e "rolename={toxinidir}" \
-e "install_test_packages=True" \ -e "install_test_packages=True" \
-e @{toxinidir}/tests/test-vars.yml \
{toxinidir}/tests/test.yml -vvvv {toxinidir}/tests/test.yml -vvvv
bash -c 'mkdir -p {toxinidir}/logs' {[testenv:func_logs]commands}
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/"'
[testenv:linters] [testenv:linters]