Add hosts integrated tests
We add hosts SCENARIO to run functional tests against roles that runs with setup-hosts.yml play. As for now we've added test coverage for openstack_hosts role. We're also adding infra upgrade jobs. Change-Id: Iefb94b31da3d84b8e48681aa4ca30322aa2b3993 Needed-By: https://review.opendev.org/c/openstack/openstack-ansible-openstack_hosts/+/774688
This commit is contained in:
parent
93b668a649
commit
c63992298e
@ -65,39 +65,63 @@
|
||||
that:
|
||||
- internal_lb_vip_address | ipaddr('private')
|
||||
|
||||
- name: Ensure settings are not wrong with the usual suspects issues before trying to deploy infra
|
||||
hosts: haproxy
|
||||
gather_facts: yes
|
||||
# Test openstack_hosts role
|
||||
- name: Playbook for role testing
|
||||
hosts: localhost
|
||||
become: true
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: Checking that the LB vips are well configured.
|
||||
assert:
|
||||
that:
|
||||
- external_lb_vip_address != internal_lb_vip_address
|
||||
msg: |
|
||||
External and Internal LB vip addresses are the same.
|
||||
Run with -e vipcheck=False if you want to bypass this check.
|
||||
when:
|
||||
- vipcheck | default(True) | bool
|
||||
- inventory_hostname == ansible_play_hosts[0]
|
||||
- name: Open modules file
|
||||
slurp:
|
||||
src: "{{ (ansible_os_family | lower == 'debian') | ternary('/etc/modules', '/etc/modules-load.d/openstack-ansible.conf') }}"
|
||||
register: modules_file
|
||||
|
||||
- name: Checking that vip nics are well configured
|
||||
assert:
|
||||
that:
|
||||
- item in ansible_interfaces
|
||||
msg: "Misconfigured keepalived IP, the carrying interface {{ item }} doesn't exist"
|
||||
with_items:
|
||||
- "{{ haproxy_keepalived_external_interface }}"
|
||||
- "{{ haproxy_keepalived_internal_interface }}"
|
||||
when:
|
||||
- groups['haproxy'] | length > 1
|
||||
- name: Open sysctl file
|
||||
slurp:
|
||||
src: /etc/sysctl.conf
|
||||
register: sysctl_file
|
||||
|
||||
- name: Checking that vip address is well formed
|
||||
- name: Open hosts file
|
||||
slurp:
|
||||
src: /etc/hosts
|
||||
register: hosts_file
|
||||
|
||||
- name: Open /etc/environment file
|
||||
slurp:
|
||||
src: /etc/environment
|
||||
register: environment_file
|
||||
|
||||
- name: Read files
|
||||
set_fact:
|
||||
modules_content: "{{ modules_file.content | b64decode }}"
|
||||
sysctl_content: "{{ sysctl_file.content | b64decode }}"
|
||||
hosts_content: "{{ hosts_file.content | b64decode }}"
|
||||
environment_content: "{{ environment_file.content | b64decode }}"
|
||||
|
||||
- name: Check for release file
|
||||
stat:
|
||||
path: /etc/openstack-release
|
||||
register: release_file
|
||||
|
||||
- name: Check for systat file
|
||||
stat:
|
||||
path: "{{ (ansible_os_family | lower == 'debian') | ternary('/etc/default/sysstat', '/etc/sysconfig/sysstat') }}"
|
||||
register: systat_file
|
||||
|
||||
- name: Check for ssh dir
|
||||
stat:
|
||||
path: "{{ ansible_env.HOME }}/.ssh"
|
||||
register: ssh_dir
|
||||
|
||||
- name: Check role functions
|
||||
assert:
|
||||
that:
|
||||
- item | ipaddr('address')
|
||||
msg: "Misconfigured keepalived: The vip {{ item }} is not an IP address, but a network"
|
||||
with_items:
|
||||
- "{{ haproxy_keepalived_internal_vip_cidr }}"
|
||||
- "{{ haproxy_keepalived_external_vip_cidr }}"
|
||||
when:
|
||||
- groups['haproxy'] | length > 1
|
||||
- "'dm_multipath' in modules_content"
|
||||
- "'ebtables' in modules_content"
|
||||
- "'vm.swappiness' in sysctl_content"
|
||||
- "'172.29.236.100 {{ ansible_fqdn }} {{ ansible_hostname }}' in hosts_content"
|
||||
- "'{{ hostvars[groups['galera_all'][0]]['container_address'] }} {{ hostvars[groups['galera_all'][0]]['ansible_hostname'] }}.openstack.local {{ hostvars[groups['galera_all'][0]]['ansible_hostname'] ~ ((hostvars[groups['galera_all'][0]]['ansible_hostname'] != groups['galera_all'][0]) | ternary(' ' ~ groups['galera_all'][0], '')) }}' in hosts_content"
|
||||
- "release_file.stat.exists"
|
||||
- "systat_file.stat.exists"
|
||||
- "'PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' in environment_content"
|
||||
- "ssh_dir.stat.isdir"
|
||||
|
@ -178,6 +178,12 @@ else
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
if [[ $SCENARIO =~ "hosts" ]]; then
|
||||
# Verify our hosts setup and do not continue with openstack/infra part
|
||||
openstack-ansible healthcheck-hosts.yml -e osa_gather_facts=False
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Reload environment file and apply variables for the session
|
||||
set -a
|
||||
. /etc/environment
|
||||
@ -195,7 +201,7 @@ else
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
|
||||
if [[ $SCENARIO =~ "infra" ]]; then
|
||||
if [[ $SCENARIO =~ "infra" && $ACTION != "upgrade" ]]; then
|
||||
# Verify our infra setup and do not continue with openstack part
|
||||
openstack-ansible healthcheck-infrastructure.yml -e osa_gather_facts=False
|
||||
fi
|
||||
@ -242,6 +248,11 @@ if [[ "${ACTION}" == "upgrade" ]]; then
|
||||
# upgrade is irreversable.
|
||||
echo 'YES' | bash "${OSA_CLONE_DIR}/scripts/run-upgrade.sh"
|
||||
|
||||
if [[ $SCENARIO =~ "infra" ]]; then
|
||||
# Verify our infra setup after upgrade
|
||||
openstack-ansible ${OSA_CLONE_DIR}/playbooks/healthcheck-infrastructure.yml -e osa_gather_facts=False
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exit_success
|
||||
|
@ -296,11 +296,32 @@
|
||||
nodeset: ubuntu-focal
|
||||
timeout: 10800
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-upgrade-infra_lxc-ubuntu-focal
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: ubuntu-focal
|
||||
timeout: 10800
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-infra_lxc-ubuntu-focal
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: ubuntu-focal
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_lxc-ubuntu-focal
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: ubuntu-focal
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_distro_lxc-ubuntu-focal
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: ubuntu-focal
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_metal-ubuntu-focal
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: ubuntu-focal
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-aio_distro_lxc-ubuntu-focal
|
||||
parent: openstack-ansible-deploy-aio-distro
|
||||
@ -407,6 +428,21 @@
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: centos-8
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_distro_lxc-centos-8
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: centos-8
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_lxc-centos-8
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: centos-8
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_metal-centos-8
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: centos-8
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-aio_distro_lxc-centos-8
|
||||
parent: openstack-ansible-deploy-aio-distro
|
||||
@ -428,6 +464,12 @@
|
||||
nodeset: centos-8
|
||||
timeout: 10800
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-upgrade-infra_lxc-centos-8
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: centos-8
|
||||
timeout: 10800
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-aio_metal-centos-8
|
||||
parent: openstack-ansible-deploy-aio
|
||||
@ -477,6 +519,21 @@
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: debian-buster
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_lxc-debian-buster
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: debian-buster
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_distro_lxc-debian-buster
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: debian-buster
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-hosts_metal-debian-buster
|
||||
parent: openstack-ansible-deploy-aio
|
||||
nodeset: debian-buster
|
||||
|
||||
- job:
|
||||
name: openstack-ansible-deploy-aio_distro_lxc-debian-buster
|
||||
parent: openstack-ansible-deploy-aio-distro
|
||||
|
@ -52,6 +52,17 @@
|
||||
- openstack-ansible-deploy-aio_lxc-ubuntu-focal
|
||||
- openstack-ansible-upgrade-aio_lxc-ubuntu-focal
|
||||
|
||||
- project-template:
|
||||
name: openstack-ansible-upgrade-infra_lxc-jobs
|
||||
check:
|
||||
jobs:
|
||||
- openstack-ansible-upgrade-infra_lxc-centos-8:
|
||||
voting: false
|
||||
- openstack-ansible-upgrade-infra_lxc-ubuntu-focal
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-ansible-upgrade-infra_lxc-ubuntu-focal
|
||||
|
||||
- project-template:
|
||||
name: openstack-ansible-upgrade-aio_metal-jobs
|
||||
check:
|
||||
@ -79,6 +90,51 @@
|
||||
jobs:
|
||||
- openstack-ansible-deploy-infra_lxc-ubuntu-focal
|
||||
|
||||
- project-template:
|
||||
name: openstack-ansible-deploy-hosts_lxc-jobs
|
||||
check:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_lxc-centos-8
|
||||
- openstack-ansible-deploy-hosts_lxc-debian-buster
|
||||
- openstack-ansible-deploy-hosts_lxc-ubuntu-focal
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_lxc-centos-8
|
||||
- openstack-ansible-deploy-hosts_lxc-debian-buster
|
||||
- openstack-ansible-deploy-hosts_lxc-ubuntu-focal
|
||||
periodic:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_lxc-ubuntu-focal
|
||||
|
||||
- project-template:
|
||||
name: openstack-ansible-deploy-hosts_metal-jobs
|
||||
check:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_metal-centos-8
|
||||
- openstack-ansible-deploy-hosts_metal-debian-buster
|
||||
- openstack-ansible-deploy-hosts_metal-ubuntu-focal
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_metal-centos-8
|
||||
- openstack-ansible-deploy-hosts_metal-debian-buster
|
||||
- openstack-ansible-deploy-hosts_metal-ubuntu-focal
|
||||
periodic:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_metal-ubuntu-focal
|
||||
|
||||
- project-template:
|
||||
name: openstack-ansible-deploy-hosts_distro_lxc-jobs
|
||||
check:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_distro_lxc-centos-8
|
||||
- openstack-ansible-deploy-hosts_distro_lxc-debian-buster
|
||||
- openstack-ansible-deploy-hosts_distro_lxc-ubuntu-focal
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-ansible-deploy-hosts_distro_lxc-centos-8
|
||||
- openstack-ansible-deploy-hosts_distro_lxc-debian-buster
|
||||
- openstack-ansible-deploy-hosts_distro_lxc-ubuntu-focal
|
||||
|
||||
- project-template:
|
||||
name: openstack-ansible-deploy-aio_distro_lxc-jobs
|
||||
experimental:
|
||||
|
Loading…
Reference in New Issue
Block a user