Initial unit testing of ansible - kolla-ansible role
Adds a new tox environment, ansible, which runs ansible unit tests. One such test has been implemented so far, for the kolla-ansible role.
This commit is contained in:
parent
91c341ad3e
commit
76309988ff
1
.gitignore
vendored
1
.gitignore
vendored
@ -47,6 +47,7 @@ doc/build
|
|||||||
|
|
||||||
# Files generated by Ansible
|
# Files generated by Ansible
|
||||||
ansible/*.retry
|
ansible/*.retry
|
||||||
|
ansible/roles/*/tests/*.retry
|
||||||
|
|
||||||
# Ansible Galaxy roles
|
# Ansible Galaxy roles
|
||||||
ansible/roles/ahuffman.resolv/
|
ansible/roles/ahuffman.resolv/
|
||||||
|
14
.travis.yml
14
.travis.yml
@ -2,14 +2,15 @@
|
|||||||
language: python
|
language: python
|
||||||
python: "2.7"
|
python: "2.7"
|
||||||
|
|
||||||
# Run jobs in containers.
|
# Run jobs in VMs - sudo is required by ansible tests.
|
||||||
sudo: false
|
sudo: required
|
||||||
|
|
||||||
# Install ansible
|
# Install ansible
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- gcc
|
- gcc
|
||||||
|
- python-apt
|
||||||
- python-virtualenv
|
- python-virtualenv
|
||||||
- realpath
|
- realpath
|
||||||
|
|
||||||
@ -24,10 +25,15 @@ env:
|
|||||||
- TOX_ENV=py27
|
- TOX_ENV=py27
|
||||||
# Run ansible syntax checks.
|
# Run ansible syntax checks.
|
||||||
- TOX_ENV=ansible-syntax
|
- TOX_ENV=ansible-syntax
|
||||||
|
# Run ansible tests.
|
||||||
|
- TOX_ENV=ansible
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install tox
|
# Install tox in a virtualenv to ensure we have an up to date version.
|
||||||
|
- virtualenv venv
|
||||||
|
- venv/bin/pip install -U pip
|
||||||
|
- venv/bin/pip install tox
|
||||||
|
|
||||||
script:
|
script:
|
||||||
# Run the tox environment.
|
# Run the tox environment.
|
||||||
- tox -e ${TOX_ENV}
|
- venv/bin/tox -e ${TOX_ENV}
|
||||||
|
21
ansible/roles/kolla-ansible/tests/main.yml
Normal file
21
ansible/roles/kolla-ansible/tests/main.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
# TODO:
|
||||||
|
# - Check inventory file.
|
||||||
|
# - Add hosts to inventory.
|
||||||
|
# - Seed custom inventory
|
||||||
|
# - Overcloud custom inventory
|
||||||
|
# - Group map
|
||||||
|
# - Pass through variables
|
||||||
|
# - Nova ironic compute host
|
||||||
|
|
||||||
|
- include: test-defaults.yml
|
||||||
|
- include: test-extras.yml
|
||||||
|
|
||||||
|
- hosts: localhost
|
||||||
|
connection: local
|
||||||
|
tasks:
|
||||||
|
- name: Fail if any tests failed
|
||||||
|
fail:
|
||||||
|
msg: >
|
||||||
|
Test failures: {{ test_failures }}
|
||||||
|
when: test_failures is defined
|
162
ansible/roles/kolla-ansible/tests/test-defaults.yml
Normal file
162
ansible/roles/kolla-ansible/tests/test-defaults.yml
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
connection: local
|
||||||
|
tasks:
|
||||||
|
- name: Create a temporary directory
|
||||||
|
tempfile:
|
||||||
|
state: directory
|
||||||
|
register: tempfile_result
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Test the kolla-ansible role with default values
|
||||||
|
include_role:
|
||||||
|
name: ../../kolla-ansible
|
||||||
|
vars:
|
||||||
|
kolla_ansible_source_path: "{{ temp_path }}/src"
|
||||||
|
kolla_ansible_ctl_install_type: "source"
|
||||||
|
kolla_ansible_source_url: "http://github.com/openstack/kolla-ansible"
|
||||||
|
kolla_ansible_source_version: "master"
|
||||||
|
kolla_ansible_venv: "{{ temp_path }}/venv"
|
||||||
|
kolla_config_path: "{{ temp_path }}/etc/kolla"
|
||||||
|
kolla_node_custom_config_path: "{{ temp_path }}/etc/kolla/config"
|
||||||
|
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
|
||||||
|
# Required config.
|
||||||
|
kolla_base_distro: "fake-distro"
|
||||||
|
kolla_install_type: "fake-install-type"
|
||||||
|
kolla_docker_namespace: "fake-namespace"
|
||||||
|
kolla_openstack_release: "fake-release"
|
||||||
|
kolla_internal_vip_address: "10.0.0.1"
|
||||||
|
kolla_internal_fqdn: "fake.internal.fqdn"
|
||||||
|
kolla_external_vip_address: "10.0.0.2"
|
||||||
|
kolla_external_fqdn: "fake.external.fqdn"
|
||||||
|
kolla_network_interface: "eth0"
|
||||||
|
kolla_external_vip_interface: "eth1"
|
||||||
|
kolla_api_interface: "eth2"
|
||||||
|
kolla_storage_interface: "eth3"
|
||||||
|
kolla_cluster_interface: "eth4"
|
||||||
|
kolla_dns_interface: "eth5"
|
||||||
|
kolla_neutron_external_interfaces:
|
||||||
|
- "eth6"
|
||||||
|
- "eth7"
|
||||||
|
kolla_neutron_bridge_names:
|
||||||
|
- "br0"
|
||||||
|
- "br1"
|
||||||
|
kolla_bifrost_network_interface: "eth8"
|
||||||
|
kolla_provision_interface: "eth9"
|
||||||
|
kolla_inspector_dnsmasq_interface: "eth10"
|
||||||
|
kolla_enable_tls_external: False
|
||||||
|
kolla_external_fqdn_cert: "fake-cert"
|
||||||
|
kolla_openstack_logging_debug: False
|
||||||
|
|
||||||
|
- name: Verify kolla-ansible installation
|
||||||
|
command: "{{ temp_path }}/venv/bin/kolla-ansible -h"
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Verify ansible installation
|
||||||
|
command: "{{ temp_path }}/venv/bin/ansible -h"
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Validate globals.yml contents
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- item.key in globals_yml
|
||||||
|
- globals_yml[item.key] == item.value
|
||||||
|
msg: >
|
||||||
|
Unexpected value for variable "{{ item.key }}" in globals.yml.
|
||||||
|
Expected "{{ item.value }}", actual
|
||||||
|
"{{ globals_yml.get(item.key, '<missing>') }}".
|
||||||
|
with_dict: "{{ expected_variables }}"
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
globals_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/globals.yml') | from_yaml }}"
|
||||||
|
expected_variables:
|
||||||
|
config_strategy: "COPY_ALWAYS"
|
||||||
|
kolla_base_distro: "fake-distro"
|
||||||
|
kolla_install_type: "fake-install-type"
|
||||||
|
openstack_release: "fake-release"
|
||||||
|
kolla_internal_vip_address: "10.0.0.1"
|
||||||
|
kolla_internal_fqdn: "fake.internal.fqdn"
|
||||||
|
kolla_external_vip_address: "10.0.0.2"
|
||||||
|
kolla_external_fqdn: "fake.external.fqdn"
|
||||||
|
node_custom_config: "{{ temp_path }}/etc/kolla/config"
|
||||||
|
docker_namespace: "fake-namespace"
|
||||||
|
network_interface: "eth0"
|
||||||
|
kolla_external_vip_interface: "eth1"
|
||||||
|
api_interface: "eth2"
|
||||||
|
storage_interface: "eth3"
|
||||||
|
cluster_interface: "eth4"
|
||||||
|
dns_interface: "eth5"
|
||||||
|
neutron_external_interface: "eth6,eth7"
|
||||||
|
neutron_bridge_name: "br0,br1"
|
||||||
|
bifrost_network_interface: "eth8"
|
||||||
|
provision_interface: "eth9"
|
||||||
|
ironic_dnsmasq_interface: "eth10"
|
||||||
|
neutron_plugin_agent: "openvswitch"
|
||||||
|
kolla_enable_tls_external: False
|
||||||
|
kolla_external_fqdn_cert: "fake-cert"
|
||||||
|
openstack_logging_debug: False
|
||||||
|
|
||||||
|
- name: Validate variables are absent from globals.yml
|
||||||
|
assert:
|
||||||
|
that: item not in globals_yml
|
||||||
|
msg: >
|
||||||
|
Unexpected variable "{{ item }}" found in globals.yml, value
|
||||||
|
"{{ globals_yml.get(item) }}".
|
||||||
|
with_items: "{{ unexpected_variables }}"
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
globals_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/globals.yml') | from_yaml }}"
|
||||||
|
unexpected_variables:
|
||||||
|
- docker_registry
|
||||||
|
- docker_registry_username
|
||||||
|
- docker_registry_password
|
||||||
|
- neutron_type_drivers
|
||||||
|
- neutron_tenant_network_types
|
||||||
|
- enable_glance
|
||||||
|
- enable_ironic
|
||||||
|
- enable_neutron
|
||||||
|
- enable_nova
|
||||||
|
|
||||||
|
- name: Check whether inventory files exist
|
||||||
|
stat:
|
||||||
|
path: "{{ temp_path ~ '/etc/kolla/inventory/' ~ item }}"
|
||||||
|
with_items:
|
||||||
|
- seed
|
||||||
|
- overcloud
|
||||||
|
register: inventory_stat
|
||||||
|
|
||||||
|
- name: Validate inventory files
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- item.stat.exists
|
||||||
|
- item.stat.size > 0
|
||||||
|
msg: >
|
||||||
|
Inventory file {{ item.item }} was not found.
|
||||||
|
with_items: "{{ inventory_stat.results }}"
|
||||||
|
|
||||||
|
- name: Validate passwords.yml contents
|
||||||
|
assert:
|
||||||
|
that: item in passwords_yml
|
||||||
|
msg: >
|
||||||
|
Expected variable "{{ item }}" not present in passwords.yml.
|
||||||
|
with_items: "{{ expected_variables }}"
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
passwords_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/passwords.yml') | from_yaml }}"
|
||||||
|
expected_variables:
|
||||||
|
- database_password
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: Ensure the temporary directory is removed
|
||||||
|
file:
|
||||||
|
path: "{{ temp_path }}"
|
||||||
|
state: absent
|
||||||
|
rescue:
|
||||||
|
- name: Flag that a failure occurred
|
||||||
|
set_fact:
|
||||||
|
test_failures: "{{ test_failures | default(0) | int + 1 }}"
|
||||||
|
vars:
|
||||||
|
temp_path: "{{ tempfile_result.path }}"
|
321
ansible/roles/kolla-ansible/tests/test-extras.yml
Normal file
321
ansible/roles/kolla-ansible/tests/test-extras.yml
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
connection: local
|
||||||
|
tasks:
|
||||||
|
- name: Create a temporary directory
|
||||||
|
tempfile:
|
||||||
|
state: directory
|
||||||
|
register: tempfile_result
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Test the kolla-ansible role with default values
|
||||||
|
include_role:
|
||||||
|
name: ../../kolla-ansible
|
||||||
|
static: False
|
||||||
|
vars:
|
||||||
|
kolla_ansible_source_path: "{{ temp_path }}/src"
|
||||||
|
kolla_ansible_ctl_install_type: "source"
|
||||||
|
kolla_ansible_source_url: "http://github.com/openstack/kolla-ansible"
|
||||||
|
kolla_ansible_source_version: "master"
|
||||||
|
kolla_ansible_venv: "{{ temp_path }}/venv"
|
||||||
|
kolla_ansible_vault_password: "fake-password"
|
||||||
|
kolla_config_path: "{{ temp_path }}/etc/kolla"
|
||||||
|
kolla_node_custom_config_path: "{{ temp_path }}/etc/kolla/config"
|
||||||
|
kolla_ansible_passwords_path: "{{ temp_path }}/passwords.yml"
|
||||||
|
# Config.
|
||||||
|
kolla_base_distro: "fake-distro"
|
||||||
|
kolla_install_type: "fake-install-type"
|
||||||
|
kolla_docker_namespace: "fake-namespace"
|
||||||
|
kolla_openstack_release: "fake-release"
|
||||||
|
kolla_internal_vip_address: "10.0.0.1"
|
||||||
|
kolla_internal_fqdn: "fake.internal.fqdn"
|
||||||
|
kolla_external_vip_address: "10.0.0.2"
|
||||||
|
kolla_external_fqdn: "fake.external.fqdn"
|
||||||
|
kolla_network_interface: "eth0"
|
||||||
|
kolla_external_vip_interface: "eth1"
|
||||||
|
kolla_api_interface: "eth2"
|
||||||
|
kolla_storage_interface: "eth3"
|
||||||
|
kolla_cluster_interface: "eth4"
|
||||||
|
kolla_dns_interface: "eth5"
|
||||||
|
kolla_neutron_external_interfaces:
|
||||||
|
- "eth6"
|
||||||
|
- "eth7"
|
||||||
|
kolla_neutron_bridge_names:
|
||||||
|
- "br0"
|
||||||
|
- "br1"
|
||||||
|
kolla_bifrost_network_interface: "eth8"
|
||||||
|
kolla_provision_interface: "eth9"
|
||||||
|
kolla_inspector_dnsmasq_interface: "eth10"
|
||||||
|
kolla_neutron_ml2_type_drivers:
|
||||||
|
- "fake-ml2-type-1"
|
||||||
|
- "fake-ml2-type-2"
|
||||||
|
kolla_neutron_ml2_tenant_network_types:
|
||||||
|
- "fake-ml2-tenant-type-1"
|
||||||
|
- "fake-ml2-tenant-type-2"
|
||||||
|
kolla_enable_tls_external: False
|
||||||
|
kolla_external_fqdn_cert: "fake-cert"
|
||||||
|
kolla_openstack_logging_debug: True
|
||||||
|
# Enable everything.
|
||||||
|
kolla_enable_aodh: True
|
||||||
|
kolla_enable_barbican: True
|
||||||
|
kolla_enable_ceilometer: True
|
||||||
|
kolla_enable_central_logging: True
|
||||||
|
kolla_enable_ceph: True
|
||||||
|
kolla_enable_ceph_rgw: True
|
||||||
|
kolla_enable_cinder: True
|
||||||
|
kolla_enable_cinder_backend_hnas_iscsi: True
|
||||||
|
kolla_enable_cinder_backend_hnas_nfs: True
|
||||||
|
kolla_enable_cinder_backend_iscsi: True
|
||||||
|
kolla_enable_cinder_backend_lvm: True
|
||||||
|
kolla_enable_cinder_backend_nfs: True
|
||||||
|
kolla_enable_cloudkitty: True
|
||||||
|
kolla_enable_congress: True
|
||||||
|
kolla_enable_designate: True
|
||||||
|
kolla_enable_elasticsearch: True
|
||||||
|
kolla_enable_etcd: True
|
||||||
|
kolla_enable_freezer: True
|
||||||
|
kolla_enable_gnocchi: True
|
||||||
|
kolla_enable_grafana: True
|
||||||
|
kolla_enable_haproxy: True
|
||||||
|
kolla_enable_heat: True
|
||||||
|
kolla_enable_horizon: True
|
||||||
|
kolla_enable_influxdb: True
|
||||||
|
kolla_enable_ironic: True
|
||||||
|
kolla_enable_karbor: True
|
||||||
|
kolla_enable_kibana: True
|
||||||
|
kolla_enable_kuryr: True
|
||||||
|
kolla_enable_magnum: True
|
||||||
|
kolla_enable_manila: True
|
||||||
|
kolla_enable_manila_backend_generic: True
|
||||||
|
kolla_enable_manila_backend_hnas: True
|
||||||
|
kolla_enable_mistral: True
|
||||||
|
kolla_enable_mongodb: True
|
||||||
|
kolla_enable_murano: True
|
||||||
|
kolla_enable_multipathd: True
|
||||||
|
kolla_enable_neutron_agent_ha: True
|
||||||
|
kolla_enable_neutron_bgp_dragent: True
|
||||||
|
kolla_enable_neutron_dvr: True
|
||||||
|
kolla_enable_neutron_fwaas: True
|
||||||
|
kolla_enable_neutron_lbaas: True
|
||||||
|
kolla_enable_neutron_provider_networks: True
|
||||||
|
kolla_enable_neutron_qos: True
|
||||||
|
kolla_enable_neutron_vpnaas: True
|
||||||
|
kolla_enable_nova_serialconsole_proxy: True
|
||||||
|
kolla_enable_octavia: True
|
||||||
|
kolla_enable_osprofiler: True
|
||||||
|
kolla_enable_panko: True
|
||||||
|
kolla_enable_rally: True
|
||||||
|
kolla_enable_searchlight: True
|
||||||
|
kolla_enable_sahara: True
|
||||||
|
kolla_enable_senlin: True
|
||||||
|
kolla_enable_skydive: True
|
||||||
|
kolla_enable_solum: True
|
||||||
|
kolla_enable_swift: True
|
||||||
|
kolla_enable_tacker: True
|
||||||
|
kolla_enable_telegraf: True
|
||||||
|
kolla_enable_tempest: True
|
||||||
|
kolla_enable_trove: True
|
||||||
|
kolla_enable_watcher: True
|
||||||
|
kolla_enable_zun: True
|
||||||
|
kolla_extra_globals:
|
||||||
|
extra-global-1: "extra-val-1"
|
||||||
|
extra-global-2: "extra-val-2"
|
||||||
|
kolla_ansible_custom_passwords:
|
||||||
|
custom-password-1: "custom-password-1"
|
||||||
|
custom-password-2: "custom-password-2"
|
||||||
|
kolla_nova_compute_ironic_host: "controller1"
|
||||||
|
|
||||||
|
- name: Verify kolla-ansible installation
|
||||||
|
command: "{{ temp_path }}/venv/bin/kolla-ansible -h"
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Verify ansible installation
|
||||||
|
command: "{{ temp_path }}/venv/bin/ansible -h"
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Validate variables are absent from globals.yml
|
||||||
|
debug:
|
||||||
|
var: globals_yml
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
globals_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/globals.yml') | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Validate globals.yml contents
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- item.key in globals_yml
|
||||||
|
- globals_yml[item.key] == item.value
|
||||||
|
msg: >
|
||||||
|
Unexpected value for variable "{{ item.key }}" in globals.yml.
|
||||||
|
Expected "{{ item.value }}", actual
|
||||||
|
"{{ globals_yml.get(item.key, '<missing>') }}".
|
||||||
|
with_dict: "{{ expected_variables }}"
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
globals_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/globals.yml') | from_yaml }}"
|
||||||
|
expected_variables:
|
||||||
|
config_strategy: "COPY_ALWAYS"
|
||||||
|
kolla_base_distro: "fake-distro"
|
||||||
|
kolla_install_type: "fake-install-type"
|
||||||
|
openstack_release: "fake-release"
|
||||||
|
kolla_internal_vip_address: "10.0.0.1"
|
||||||
|
kolla_internal_fqdn: "fake.internal.fqdn"
|
||||||
|
kolla_external_vip_address: "10.0.0.2"
|
||||||
|
kolla_external_fqdn: "fake.external.fqdn"
|
||||||
|
node_custom_config: "{{ temp_path }}/etc/kolla/config"
|
||||||
|
docker_namespace: "fake-namespace"
|
||||||
|
network_interface: "eth0"
|
||||||
|
kolla_external_vip_interface: "eth1"
|
||||||
|
api_interface: "eth2"
|
||||||
|
storage_interface: "eth3"
|
||||||
|
cluster_interface: "eth4"
|
||||||
|
dns_interface: "eth5"
|
||||||
|
neutron_external_interface: "eth6,eth7"
|
||||||
|
neutron_bridge_name: "br0,br1"
|
||||||
|
bifrost_network_interface: "eth8"
|
||||||
|
provision_interface: "eth9"
|
||||||
|
ironic_dnsmasq_interface: "eth10"
|
||||||
|
neutron_plugin_agent: "openvswitch"
|
||||||
|
kolla_enable_tls_external: False
|
||||||
|
kolla_external_fqdn_cert: "fake-cert"
|
||||||
|
openstack_logging_debug: True
|
||||||
|
# NOTE: The following options are not present in globals.yml.
|
||||||
|
# It's possible this is related to the use of hostvars and
|
||||||
|
# include_role, caused by something like
|
||||||
|
# https://github.com/ansible/ansible/issues/19305.
|
||||||
|
#enable_aodh: True
|
||||||
|
#enable_barbican: True
|
||||||
|
#enable_ceilometer: True
|
||||||
|
#enable_central_logging: True
|
||||||
|
#enable_ceph: True
|
||||||
|
#enable_ceph_rgw: True
|
||||||
|
#enable_cinder: True
|
||||||
|
#enable_cinder_backend_iscsi: True
|
||||||
|
#enable_cinder_backend_hnas_iscsi: True
|
||||||
|
#enable_cinder_backend_hnas_nfs: True
|
||||||
|
#enable_cinder_backend_lvm: True
|
||||||
|
#enable_cinder_backend_nfs: True
|
||||||
|
#enable_cloudkitty: True
|
||||||
|
#enable_congress: True
|
||||||
|
#enable_designate: True
|
||||||
|
#enable_elasticsearch: True
|
||||||
|
#enable_etcd: True
|
||||||
|
#enable_freezer: True
|
||||||
|
#enable_gnocchi: True
|
||||||
|
#enable_grafana: True
|
||||||
|
#enable_haproxy: True
|
||||||
|
#enable_heat: True
|
||||||
|
#enable_horizon: True
|
||||||
|
#enable_influxdb: True
|
||||||
|
#enable_ironic: True
|
||||||
|
#enable_karbor: True
|
||||||
|
#enable_kibana: True
|
||||||
|
#enable_kuryr: True
|
||||||
|
#enable_magnum: True
|
||||||
|
#enable_manila: True
|
||||||
|
#enable_manila_backend_generic: True
|
||||||
|
#enable_manila_backend_hnas: True
|
||||||
|
#enable_mistral: True
|
||||||
|
#enable_mongodb: True
|
||||||
|
#enable_murano: True
|
||||||
|
#enable_multipathd: True
|
||||||
|
#enable_neutron_agent_ha: True
|
||||||
|
#enable_neutron_bgp_dragent: True
|
||||||
|
#enable_neutron_dvr: True
|
||||||
|
#enable_neutron_fwaas: True
|
||||||
|
#enable_neutron_lbaas: True
|
||||||
|
#enable_neutron_provider_networks: True
|
||||||
|
#enable_neutron_qos: True
|
||||||
|
#enable_neutron_vpnaas: True
|
||||||
|
#enable_nova_serialconsole_proxy: True
|
||||||
|
#enable_octavia: True
|
||||||
|
#enable_osprofiler: True
|
||||||
|
#enable_panko: True
|
||||||
|
#enable_rally: True
|
||||||
|
#enable_sahara: True
|
||||||
|
#enable_searchlight: True
|
||||||
|
#enable_skydive: True
|
||||||
|
#enable_solum: True
|
||||||
|
#enable_senlin: True
|
||||||
|
#enable_swift: True
|
||||||
|
#enable_tacker: True
|
||||||
|
#enable_telegraf: True
|
||||||
|
#enable_tempest: True
|
||||||
|
#enable_trove: True
|
||||||
|
#enable_watcher: True
|
||||||
|
#enable_zun: True
|
||||||
|
extra-global-1: "extra-val-1"
|
||||||
|
extra-global-2: "extra-val-2"
|
||||||
|
|
||||||
|
- name: Validate variables are absent from globals.yml
|
||||||
|
assert:
|
||||||
|
that: item not in globals_yml
|
||||||
|
msg: >
|
||||||
|
Unexpected variable "{{ item }}" found in globals.yml, value
|
||||||
|
"{{ globals_yml.get(item) }}".
|
||||||
|
with_items: "{{ unexpected_variables }}"
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
globals_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/globals.yml') | from_yaml }}"
|
||||||
|
unexpected_variables:
|
||||||
|
- docker_registry
|
||||||
|
- docker_registry_username
|
||||||
|
- docker_registry_password
|
||||||
|
- enable_glance
|
||||||
|
- enable_ironic
|
||||||
|
- enable_neutron
|
||||||
|
- enable_nova
|
||||||
|
|
||||||
|
- name: Create a vault password file
|
||||||
|
copy:
|
||||||
|
content: "fake-password"
|
||||||
|
dest: "{{ temp_path ~ '/vault-pass' }}"
|
||||||
|
|
||||||
|
- name: Decrypt passwords.yml
|
||||||
|
command: ansible-vault decrypt --vault-password-file {{ temp_path ~ '/vault-pass' }} {{ temp_path ~ '/etc/kolla/passwords.yml' }}
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Validate passwords.yml contents
|
||||||
|
assert:
|
||||||
|
that: item in passwords_yml
|
||||||
|
msg: >
|
||||||
|
Expected variable "{{ item }}" not present in passwords.yml.
|
||||||
|
with_items: "{{ expected_variables }}"
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
passwords_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/passwords.yml') | from_yaml }}"
|
||||||
|
expected_variables:
|
||||||
|
- database_password
|
||||||
|
- custom-password-1
|
||||||
|
- custom-password-2
|
||||||
|
|
||||||
|
- name: Validate passwords.yml custom passwords
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- item.key in passwords_yml
|
||||||
|
- passwords_yml[item.key] == item.value
|
||||||
|
msg: >
|
||||||
|
Expected custom password "{{ item.key }}" not present in passwords.yml.
|
||||||
|
with_dict: "{{ expected_variables }}"
|
||||||
|
vars:
|
||||||
|
# NOTE: Can't use set_fact for this, as it causes kolla-ansible
|
||||||
|
# Jinja expressions to be evaluated.
|
||||||
|
passwords_yml: "{{ lookup('file', temp_path ~ '/etc/kolla/passwords.yml') | from_yaml }}"
|
||||||
|
expected_variables:
|
||||||
|
custom-password-1: custom-password-1
|
||||||
|
custom-password-2: custom-password-2
|
||||||
|
always:
|
||||||
|
- name: Ensure the temporary directory is removed
|
||||||
|
file:
|
||||||
|
path: "{{ temp_path }}"
|
||||||
|
state: absent
|
||||||
|
rescue:
|
||||||
|
- name: Flag that a failure occurred
|
||||||
|
set_fact:
|
||||||
|
test_failures: "{{ test_failures | default(0) | int + 1 }}"
|
||||||
|
vars:
|
||||||
|
temp_path: "{{ tempfile_result.path }}"
|
17
tox.ini
17
tox.ini
@ -6,6 +6,10 @@ skipsdist = True
|
|||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} {opts} {packages}
|
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} {opts} {packages}
|
||||||
|
passenv =
|
||||||
|
HOME
|
||||||
|
whitelist_externals =
|
||||||
|
bash
|
||||||
setenv =
|
setenv =
|
||||||
VIRTUAL_ENV={envdir}
|
VIRTUAL_ENV={envdir}
|
||||||
PYTHONWARNINGS=default::DeprecationWarning
|
PYTHONWARNINGS=default::DeprecationWarning
|
||||||
@ -34,6 +38,19 @@ commands = python setup.py build_sphinx
|
|||||||
[testenv:debug]
|
[testenv:debug]
|
||||||
commands = oslo_debug_helper {posargs}
|
commands = oslo_debug_helper {posargs}
|
||||||
|
|
||||||
|
[testenv:ansible]
|
||||||
|
usedevelop = True
|
||||||
|
# Create the virtualenv with access to system site packages, as this is
|
||||||
|
# required to use the python and apt modules, which are not available via PyPI.
|
||||||
|
sitepackages = True
|
||||||
|
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} {opts} {packages}
|
||||||
|
commands =
|
||||||
|
bash -c \
|
||||||
|
"ansible-playbook \
|
||||||
|
--connection=local \
|
||||||
|
{toxinidir}/ansible/roles/*/tests/main.yml \
|
||||||
|
{posargs}"
|
||||||
|
|
||||||
[testenv:alint]
|
[testenv:alint]
|
||||||
commands = ansible-lint ansible/*.yaml
|
commands = ansible-lint ansible/*.yaml
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user