Add new role for tripleo-validations
This patch allows us to run tripleo-validations tests through the Mistral framework for newton release and above. It also allows us to run negative tests for pre-introspections validations like: - undercloud-ram - undercloud-cpu - undercloud-disk-space The pre-deployment and post-deployment should be done and will be done through different patches. Change-Id: Iec07a18322252af2d484bc3f06a59dbd1b08f537 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
parent
c21bd4df57
commit
fc5bf6e315
|
@ -11,6 +11,17 @@
|
||||||
roles:
|
roles:
|
||||||
- undercloud-deploy
|
- undercloud-deploy
|
||||||
|
|
||||||
|
- name: Configure tripleo-validations
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
run_tripleo_validations_setup: True
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: copy over config files
|
- name: copy over config files
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
@ -35,6 +46,18 @@
|
||||||
roles:
|
roles:
|
||||||
- overcloud-prep-images
|
- overcloud-prep-images
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-introspection tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-introspection']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
|
|
||||||
- name: Prepare overcloud flavors
|
- name: Prepare overcloud flavors
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
@ -53,12 +76,36 @@
|
||||||
roles:
|
roles:
|
||||||
- { role: overcloud-ssl, when: ssl_overcloud|bool }
|
- { role: overcloud-ssl, when: ssl_overcloud|bool }
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
|
|
||||||
- name: Deploy the overcloud
|
- name: Deploy the overcloud
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
roles:
|
roles:
|
||||||
- overcloud-deploy
|
- overcloud-deploy
|
||||||
|
|
||||||
|
- name: Run tripleo-validations post-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['post-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
|
|
||||||
# Add the overcloud nodes to the generated inventory.
|
# Add the overcloud nodes to the generated inventory.
|
||||||
- name: Inventory the overcloud
|
- name: Inventory the overcloud
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
|
|
|
@ -38,6 +38,17 @@
|
||||||
tags:
|
tags:
|
||||||
- undercloud-deploy
|
- undercloud-deploy
|
||||||
|
|
||||||
|
- name: Configure tripleo-validations
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
run_tripleo_validations_setup: True
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Prepare baremetal for the overcloud deployment
|
- name: Prepare baremetal for the overcloud deployment
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
roles:
|
roles:
|
||||||
|
@ -70,6 +81,17 @@
|
||||||
tags:
|
tags:
|
||||||
- overcloud-prep-images
|
- overcloud-prep-images
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-introspection tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-introspection']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Prepare overcloud flavors
|
- name: Prepare overcloud flavors
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
@ -86,6 +108,17 @@
|
||||||
tags:
|
tags:
|
||||||
- overcloud-prep-network
|
- overcloud-prep-network
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Deploy the overcloud
|
- name: Deploy the overcloud
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
|
@ -94,6 +127,17 @@
|
||||||
tags:
|
tags:
|
||||||
- overcloud-deploy
|
- overcloud-deploy
|
||||||
|
|
||||||
|
- name: Run tripleo-validations post-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['post-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Add the overcloud nodes to the generated inventory
|
- name: Add the overcloud nodes to the generated inventory
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
|
@ -124,3 +168,4 @@
|
||||||
- validate-ha
|
- validate-ha
|
||||||
tags:
|
tags:
|
||||||
- overcloud-validate-ha
|
- overcloud-validate-ha
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,17 @@
|
||||||
tags:
|
tags:
|
||||||
- undercloud-deploy
|
- undercloud-deploy
|
||||||
|
|
||||||
|
- name: Configure tripleo-validations
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
run_tripleo_validations_setup: True
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Prepare baremetal for the overcloud deployment
|
- name: Prepare baremetal for the overcloud deployment
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
roles:
|
roles:
|
||||||
|
@ -70,6 +81,17 @@
|
||||||
tags:
|
tags:
|
||||||
- overcloud-prep-images
|
- overcloud-prep-images
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-introspection tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-introspection']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Prepare overcloud flavors
|
- name: Prepare overcloud flavors
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
@ -86,6 +108,17 @@
|
||||||
tags:
|
tags:
|
||||||
- overcloud-prep-network
|
- overcloud-prep-network
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Deploy the overcloud
|
- name: Deploy the overcloud
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
|
@ -94,6 +127,17 @@
|
||||||
tags:
|
tags:
|
||||||
- overcloud-deploy
|
- overcloud-deploy
|
||||||
|
|
||||||
|
- name: Run tripleo-validations post-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['post-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Add the overcloud nodes to the generated inventory
|
- name: Add the overcloud nodes to the generated inventory
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
|
@ -124,3 +168,4 @@
|
||||||
- { role: validate-simple, when: test_ping|bool }
|
- { role: validate-simple, when: test_ping|bool }
|
||||||
tags:
|
tags:
|
||||||
- overcloud-validate
|
- overcloud-validate
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,17 @@
|
||||||
roles:
|
roles:
|
||||||
- overcloud-prep-images
|
- overcloud-prep-images
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-introspection tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-introspection']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
# Prepare the overcloud flavor configuration
|
# Prepare the overcloud flavor configuration
|
||||||
- name: Prepare overcloud flavors
|
- name: Prepare overcloud flavors
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
|
@ -33,6 +44,17 @@
|
||||||
roles:
|
roles:
|
||||||
- overcloud-prep-network
|
- overcloud-prep-network
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
- name: Prepare the SSL Configuration for the overcloud deployment
|
- name: Prepare the SSL Configuration for the overcloud deployment
|
||||||
hosts: undercloud
|
hosts: undercloud
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
|
|
@ -17,6 +17,17 @@
|
||||||
roles:
|
roles:
|
||||||
- tripleo-inventory
|
- tripleo-inventory
|
||||||
|
|
||||||
|
- name: Run tripleo-validations post-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['post-deployment']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
# Check the results of the deployment, note after inventory has executed
|
# Check the results of the deployment, note after inventory has executed
|
||||||
- name: Check the result of the deployment
|
- name: Check the result of the deployment
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
|
|
|
@ -20,3 +20,15 @@
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
roles:
|
roles:
|
||||||
- undercloud-deploy
|
- undercloud-deploy
|
||||||
|
|
||||||
|
- name: Configure tripleo-validations
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
run_tripleo_validations_setup: True
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Configure tripleo-validations
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
run_tripleo_validations_setup: True
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
|
- name: Run tripleo-validations pre-introspection tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-introspection']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
Tripleo-validations
|
||||||
|
===================
|
||||||
|
|
||||||
|
An Ansible role to setup [tripleo-validations](https://github.com/openstack/tripleo-validations)
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
This playbook expects that the undercloud has been installed.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
- working_dir: <'/home/stack'> -- working directory for the role.
|
||||||
|
- run_tripleo_validations: <False> -- to setup and run tripleo-validations tests
|
||||||
|
- run_tripleo_validations_negative_tests: <False> to run negative tests
|
||||||
|
- run_tripleo_validations_setup: <False> -- to setup or not tripleo-validations
|
||||||
|
- exit_on_validations_failure: <False> -- Exit tripleo-quickstart on validations failure
|
||||||
|
- validations_group: <[]> -- The validation group name which should be
|
||||||
|
'pre-introspection', 'pre-deployment' or 'post-deployment'
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
No dependencies.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Run the tripleo-validations setup only:
|
||||||
|
|
||||||
|
- hosts: undercloud
|
||||||
|
vars:
|
||||||
|
run_tripleo_validations_setup: True
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations, when: run_tripleo_validations|bool }
|
||||||
|
|
||||||
|
Run the tripleo-validations tests belonging to the pre-introspection group:
|
||||||
|
|
||||||
|
- hosts: undercloud
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-introspection']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations, when: run_tripleo_validations|bool }
|
||||||
|
|
||||||
|
Run pre-introspection negative tests
|
||||||
|
|
||||||
|
- hosts: undercloud
|
||||||
|
vars:
|
||||||
|
validations_group: ['pre-introspection']
|
||||||
|
roles:
|
||||||
|
- { role: tripleo-validations, when: run_tripleo_validations_negative_tests|bool }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
Apache 2.0
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
RDO-CI Team
|
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
val_working_dir: "{{ working_dir }}"
|
||||||
|
|
||||||
|
run_tripleo_validations: False
|
||||||
|
run_tripleo_validations_negative_tests: False
|
||||||
|
run_tripleo_validations_setup: False
|
||||||
|
exit_on_validations_failure: False
|
||||||
|
|
||||||
|
# Tripleo-validations group name of tests, should be either pre-introspection,
|
||||||
|
# pre-deployment or post-deployment.
|
||||||
|
validations_group: []
|
||||||
|
|
||||||
|
run_tripleo_validations_script: run-tripleo-validations.sh.j2
|
||||||
|
run_preintro_val_script: run-preintro-validations-negative-tests.sh.j2
|
||||||
|
run_predep_val_script: run-predep-validations-negative-tests.sh.j2
|
||||||
|
run_postdep_val_script: run-postdep-validations-negative-tests.sh.j2
|
||||||
|
|
||||||
|
failed_validations_log: "{{ val_working_dir }}/failed_validations_log"
|
||||||
|
run_preintro_val_log: "{{ val_working_dir }}/run_preintro_validations_negative_tests.log"
|
||||||
|
|
||||||
|
validations_dir: "/usr/share/openstack-tripleo-validations/validations"
|
||||||
|
validations_static_inventory: "{{ val_working_dir }}/validations_static_inventory"
|
|
@ -0,0 +1,3 @@
|
||||||
|
dependencies:
|
||||||
|
- extras-common
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure tripleo-validations rpm requirements are installed
|
||||||
|
yum: name=openstack-tripleo-validations state=present
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Create run-tripleo-validations.sh
|
||||||
|
template:
|
||||||
|
src: "{{ run_tripleo_validations_script }}"
|
||||||
|
dest: "{{ val_working_dir }}/run-tripleo-validations.sh"
|
||||||
|
mode: 0755
|
||||||
|
when: run_tripleo_validations|bool
|
||||||
|
|
||||||
|
- when: run_tripleo_validations_negative_tests|bool
|
||||||
|
block:
|
||||||
|
- name: Create run-preintro-validations-negative-tests.sh
|
||||||
|
template:
|
||||||
|
src: "{{ run_preintro_val_script }}"
|
||||||
|
dest: "{{ val_working_dir }}/run-preintro-validations-negative-tests.sh"
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Create run-predep-validations-negative-tests.sh
|
||||||
|
template:
|
||||||
|
src: "{{ run_predep_val_script }}"
|
||||||
|
dest: "{{ val_working_dir }}/run-predep-validations-negative-tests.sh"
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Create run-postdep-validations-negative-tests.sh
|
||||||
|
template:
|
||||||
|
src: "{{ run_postdep_val_script }}"
|
||||||
|
dest: "{{ val_working_dir }}/run-postdep-validations-negative-tests.sh"
|
||||||
|
mode: 0755
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- when: release not in ['mitaka', 'liberty']
|
||||||
|
block:
|
||||||
|
- name: Installing configuration requirements
|
||||||
|
include: config.yml
|
||||||
|
static: no
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
when: run_tripleo_validations_setup|bool
|
||||||
|
|
||||||
|
- when: run_tripleo_validations|bool
|
||||||
|
block:
|
||||||
|
- name: Clean failed_validations_log file if exists
|
||||||
|
file:
|
||||||
|
path: "{{ failed_validations_log }}"
|
||||||
|
state: absent
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
|
||||||
|
- name: Run validations tests through Mistral
|
||||||
|
shell: >
|
||||||
|
{{ val_working_dir }}/run-tripleo-validations.sh {{ item }} >
|
||||||
|
{{ val_working_dir }}/validations_{{ item }}.log 2>&1
|
||||||
|
with_items:
|
||||||
|
- "{{ validations_group|default([]) }}"
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
|
||||||
|
- name: Check for failed validations log file
|
||||||
|
stat:
|
||||||
|
path: "{{ failed_validations_log }}"
|
||||||
|
register: failed_validations_log_file
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
|
||||||
|
- name: Get content of failed validations log file
|
||||||
|
command: cat {{ failed_validations_log }}
|
||||||
|
register: failed_validations_content
|
||||||
|
when: failed_validations_log_file.stat.exists|bool
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
|
||||||
|
- name: Display failed validations tests
|
||||||
|
fail:
|
||||||
|
msg:
|
||||||
|
"{{ failed_validations_content.stdout_lines }}"
|
||||||
|
ignore_errors: "{{ not (exit_on_validations_failure|bool) }}"
|
||||||
|
when: failed_validations_log_file.stat.exists|bool
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
|
||||||
|
- when: run_tripleo_validations_negative_tests|bool
|
||||||
|
block:
|
||||||
|
- name: Run negative tests for pre-introspection group
|
||||||
|
shell: >
|
||||||
|
set -o pipefail &&
|
||||||
|
{{ val_working_dir }}/run-preintro-validations-negative-tests.sh 2>&1 {{ timestamper_cmd }} >
|
||||||
|
{{ run_preintro_val_log }}
|
||||||
|
when: '"pre-introspection" in validations_group'
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ux
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
### --start_docs
|
||||||
|
## Run post-deployment validations negative tests
|
||||||
|
## ==============================================
|
||||||
|
|
||||||
|
## Prepare Your Environment
|
||||||
|
## ------------------------
|
||||||
|
|
||||||
|
## * Source in the undercloud credentials.
|
||||||
|
## ::
|
||||||
|
|
||||||
|
source {{ val_working_dir }}/stackrc
|
||||||
|
|
||||||
|
# Use custom validation-specific formatter
|
||||||
|
export ANSIBLE_STDOUT_CALLBACK=validation_output
|
||||||
|
# Disable retry files to avoid messages like this:
|
||||||
|
# [Errno 13] Permission denied:
|
||||||
|
# u'/usr/share/openstack-tripleo-validations/validations/*.retry'
|
||||||
|
export ANSIBLE_RETRY_FILES_ENABLED=false
|
||||||
|
|
||||||
|
## * Generate ansible static inventory for tripleo-validations
|
||||||
|
## ::
|
||||||
|
|
||||||
|
ANSIBLE_INVENTORY_BIN=$(which tripleo-ansible-inventory)
|
||||||
|
|
||||||
|
{% if release == 'newton' %}
|
||||||
|
export ANSIBLE_INVENTORY=${ANSIBLE_INVENTORY_BIN}
|
||||||
|
{% else %}
|
||||||
|
${ANSIBLE_INVENTORY_BIN} --static-inventory {{ validations_static_inventory }}
|
||||||
|
export ANSIBLE_INVENTORY="{{ validations_static_inventory }}"
|
||||||
|
# TODO(gchamoul) remove this workaround for bug
|
||||||
|
# https://bugs.launchpad.net/tripleo/+bug/1701239
|
||||||
|
sed -i -r 's/cacert.*//' {{ validations_static_inventory }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
# TODO(gchamoul) add negative tests for post-deployment validations
|
||||||
|
|
||||||
|
## --stop_docs
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ux
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
### --start_docs
|
||||||
|
## Run pre-deployment validations negative tests
|
||||||
|
## =============================================
|
||||||
|
|
||||||
|
## Prepare Your Environment
|
||||||
|
## ------------------------
|
||||||
|
|
||||||
|
## * Source in the undercloud credentials.
|
||||||
|
## ::
|
||||||
|
|
||||||
|
source {{ val_working_dir }}/stackrc
|
||||||
|
|
||||||
|
# Use custom validation-specific formatter
|
||||||
|
export ANSIBLE_STDOUT_CALLBACK=validation_output
|
||||||
|
# Disable retry files to avoid messages like this:
|
||||||
|
# [Errno 13] Permission denied:
|
||||||
|
# u'/usr/share/openstack-tripleo-validations/validations/*.retry'
|
||||||
|
export ANSIBLE_RETRY_FILES_ENABLED=false
|
||||||
|
|
||||||
|
## * Generate ansible static inventory for tripleo-validations
|
||||||
|
## ::
|
||||||
|
|
||||||
|
ANSIBLE_INVENTORY_BIN=$(which tripleo-ansible-inventory)
|
||||||
|
|
||||||
|
{% if release == 'newton' %}
|
||||||
|
export ANSIBLE_INVENTORY=${ANSIBLE_INVENTORY_BIN}
|
||||||
|
{% else %}
|
||||||
|
${ANSIBLE_INVENTORY_BIN} --static-inventory {{ validations_static_inventory }}
|
||||||
|
export ANSIBLE_INVENTORY="{{ validations_static_inventory }}"
|
||||||
|
# TODO(gchamoul) remove this workaround for bug
|
||||||
|
# https://bugs.launchpad.net/tripleo/+bug/1701239
|
||||||
|
sed -i -r 's/cacert.*//' {{ validations_static_inventory }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
# TODO(gchamoul) add negative tests for pre-deployment validations
|
||||||
|
|
||||||
|
## --stop_docs
|
||||||
|
|
|
@ -0,0 +1,190 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ux
|
||||||
|
|
||||||
|
### --start_docs
|
||||||
|
## Run pre-introspection validations negative tests
|
||||||
|
## ================================================
|
||||||
|
|
||||||
|
## Prepare Your Environment
|
||||||
|
## ------------------------
|
||||||
|
|
||||||
|
## * Source in the undercloud credentials.
|
||||||
|
## ::
|
||||||
|
|
||||||
|
source {{ val_working_dir }}/stackrc
|
||||||
|
|
||||||
|
# Use custom validation-specific formatter
|
||||||
|
export ANSIBLE_STDOUT_CALLBACK=validation_output
|
||||||
|
# Disable retry files to avoid messages like this:
|
||||||
|
# [Errno 13] Permission denied:
|
||||||
|
# u'/usr/share/openstack-tripleo-validations/validations/*.retry'
|
||||||
|
export ANSIBLE_RETRY_FILES_ENABLED=false
|
||||||
|
|
||||||
|
## * Generate ansible static inventory for tripleo-validations
|
||||||
|
## ::
|
||||||
|
|
||||||
|
ANSIBLE_INVENTORY_BIN=$(which tripleo-ansible-inventory)
|
||||||
|
|
||||||
|
{% if release == 'newton' %}
|
||||||
|
export ANSIBLE_INVENTORY=${ANSIBLE_INVENTORY_BIN}
|
||||||
|
{% else %}
|
||||||
|
${ANSIBLE_INVENTORY_BIN} --static-inventory {{ validations_static_inventory }}
|
||||||
|
export ANSIBLE_INVENTORY="{{ validations_static_inventory }}"
|
||||||
|
# TODO(gchamoul) remove this workaround for bug
|
||||||
|
# https://bugs.launchpad.net/tripleo/+bug/1701239
|
||||||
|
sed -i -r 's/cacert.*//' {{ validations_static_inventory }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
## `undercloud-ram` validation test
|
||||||
|
## ----------------------------------
|
||||||
|
|
||||||
|
function run_undercloud_ram {
|
||||||
|
## * Get Undercloud RAM used from tripleo-quickstart configuration
|
||||||
|
## ::
|
||||||
|
|
||||||
|
OOOQ_UNDERCLOUD_RAM_MB={{ undercloud_memory }}
|
||||||
|
|
||||||
|
## * Get the `min_undercloud_ram_gb` value from the official playbook
|
||||||
|
## ::
|
||||||
|
|
||||||
|
MIN_UNDERCLOUD_RAM_GB=$(grep 'min_undercloud_ram_gb: ' {{ validations_dir }}/undercloud-ram.yaml | tr -d ' ' | cut -d':' -f2)
|
||||||
|
|
||||||
|
MIN_UNDERCLOUD_RAM_MB=$(($MIN_UNDERCLOUD_RAM_GB * 1024))
|
||||||
|
|
||||||
|
## * Run expected failed `undercloud-ram` validation test
|
||||||
|
## ::
|
||||||
|
|
||||||
|
if (( "$OOOQ_UNDERCLOUD_RAM_MB" > "$MIN_UNDERCLOUD_RAM_MB" )); then
|
||||||
|
SHOULD_FAIL=false
|
||||||
|
else
|
||||||
|
SHOULD_FAIL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SHOULD_FAIL" = true ]; then
|
||||||
|
ansible-playbook {{ validations_dir }}/undercloud-ram.yaml
|
||||||
|
else
|
||||||
|
FAKE_UNDERCLOUD_MIN_GB=$(((MIN_UNDERCLOUD_RAM_MB + 2048) / 1024))
|
||||||
|
ansible-playbook {{ validations_dir }}/undercloud-ram.yaml \
|
||||||
|
-e min_undercloud_ram_gb=${FAKE_UNDERCLOUD_MIN_GB}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! $? -eq 0 ] && [ "$SHOULD_FAIL" = true ]; then
|
||||||
|
echo "undercloud-ram validation test has failed as expected!"
|
||||||
|
else
|
||||||
|
echo "undercloud-ram validation test has not failed as expected"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## * Run expected success `undercloud-ram` validation test
|
||||||
|
## ::
|
||||||
|
|
||||||
|
FAKE_UNDERCLOUD_MIN_GB=$(((OOOQ_UNDERCLOUD_RAM_MB - 2048) / 1024))
|
||||||
|
|
||||||
|
ansible-playbook {{ validations_dir }}/undercloud-ram.yaml \
|
||||||
|
-e min_undercloud_ram_gb=${FAKE_UNDERCLOUD_MIN_GB}
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "undercloud-ram validation test has ran sucessfully as expected!"
|
||||||
|
else
|
||||||
|
echo "undercloud-ram validation test has not ran sucessfully as expected"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## `undercloud-cpu` validation test
|
||||||
|
## --------------------------------
|
||||||
|
|
||||||
|
function run_undercloud_cpu {
|
||||||
|
## * Get Undercloud CPU numbers used from tripleo-quickstart configuration
|
||||||
|
## ::
|
||||||
|
|
||||||
|
OOOQ_UNDERCLOUD_VCPU={{ undercloud_vcpu }}
|
||||||
|
|
||||||
|
## * Get the `min_undercloud_cpu_count` value from the official playbook
|
||||||
|
## ::
|
||||||
|
|
||||||
|
MIN_UNDERCLOUD_CPU_COUNT=$(grep 'min_undercloud_cpu_count: ' {{ validations_dir }}/undercloud-cpu.yaml | tr -d ' ' | cut -d':' -f2)
|
||||||
|
|
||||||
|
## * Run expected failed `undercloud-cpu` validation test
|
||||||
|
## ::
|
||||||
|
|
||||||
|
if (( "$OOOQ_UNDERCLOUD_VCPU" > "$MIN_UNDERCLOUD_CPU_COUNT" )); then
|
||||||
|
SHOULD_FAIL=false
|
||||||
|
else
|
||||||
|
SHOULD_FAIL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
ansible-playbook {{ validations_dir }}/undercloud-cpu.yaml
|
||||||
|
|
||||||
|
if [ ! $? -eq 0 ] && [ "$SHOULD_FAIL" = true ]; then
|
||||||
|
echo "undercloud-cpu validation test has failed as expected!"
|
||||||
|
else
|
||||||
|
echo "undercloud-cpu validation test has not failed as expected"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## * Run expected success `undercloud-cpu` validation test
|
||||||
|
## ::
|
||||||
|
|
||||||
|
FAKE_UNDERCLOUD_CPU_COUNT=$((OOOQ_UNDERCLOUD_VCPU - 2))
|
||||||
|
|
||||||
|
ansible-playbook {{ validations_dir }}/undercloud-ram.yaml \
|
||||||
|
-e min_undercloud_ram_gb=${FAKE_UNDERCLOUD_CPU_COUNT}
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "undercloud-cpu validation test has ran sucessfully as expected!"
|
||||||
|
else
|
||||||
|
echo "undercloud-cpu validation test has not ran sucessfully as expected!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## `undercloud-disk-space` validation test
|
||||||
|
## ---------------------------------------
|
||||||
|
|
||||||
|
function run_undercloud_disk_space {
|
||||||
|
## * Get Undercloud disk space used from tripleo-quickstart configuration
|
||||||
|
## ::
|
||||||
|
|
||||||
|
OOOQ_UNDERCLOUD_DISK_GB={{ undercloud_disk }}
|
||||||
|
|
||||||
|
## * Get the `min_undercloud_disk_gb` value from the official playbook
|
||||||
|
## ::
|
||||||
|
|
||||||
|
MIN_UNDERCLOUD_DISK_GB=$(grep 'min_undercloud_disk_gb: ' {{ validations_dir }}/undercloud-disk-space.yaml | tr -d ' ' | cut -d':' -f2)
|
||||||
|
|
||||||
|
## * Run expected failed `undercloud-disk-space` validation test
|
||||||
|
## ::
|
||||||
|
|
||||||
|
if (( "$OOOQ_UNDERCLOUD_DISK_GB" > "$MIN_UNDERCLOUD_DISK_GB" )); then
|
||||||
|
SHOULD_FAIL=false
|
||||||
|
else
|
||||||
|
SHOULD_FAIL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
ansible-playbook {{ validations_dir }}/undercloud-disk-space.yaml
|
||||||
|
|
||||||
|
if [ ! $? -eq 0 ] && [ "$SHOULD_FAIL" = true ]; then
|
||||||
|
echo "undercloud-disk-space validation test has failed as expected!"
|
||||||
|
else
|
||||||
|
echo "undercloud-disk-space validation test has not failed as expected!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## * Run expected success `undercloud-disk-space` validation test
|
||||||
|
## ::
|
||||||
|
|
||||||
|
FAKE_UNDERCLOUD_DISK_GB=$((OOOQ_UNDERCLOUD_DISK_GB - 20))
|
||||||
|
|
||||||
|
ansible-playbook {{ validations_dir }}/undercloud-disk-space.yaml \
|
||||||
|
-e min_undercloud_disk_gb=${FAKE_UNDERCLOUD_DISK_GB}
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "undercloud-disk-space validation test has ran sucessfully as expected!"
|
||||||
|
else
|
||||||
|
echo "undercloud-disk-space validation test has not ran sucessfully as expected!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_undercloud_ram
|
||||||
|
run_undercloud_cpu
|
||||||
|
run_undercloud_disk_space
|
||||||
|
|
||||||
|
## --stop_docs
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
### --start_docs
|
||||||
|
## Run all validations for one group name
|
||||||
|
## ======================================
|
||||||
|
|
||||||
|
## Prepare Your Environment
|
||||||
|
## ------------------------
|
||||||
|
|
||||||
|
## * Source in the undercloud credentials.
|
||||||
|
## ::
|
||||||
|
|
||||||
|
source {{ val_working_dir }}/stackrc
|
||||||
|
|
||||||
|
GROUP_NAME="${1:-}"
|
||||||
|
|
||||||
|
if [ -z "$GROUP_NAME" ]; then
|
||||||
|
echo "You must specify the validation group name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
## * Getting the list of validations belonging to the group.
|
||||||
|
## ::
|
||||||
|
|
||||||
|
LIST_VALIDATIONS=$(openstack action execution \
|
||||||
|
run tripleo.validations.list_validations \
|
||||||
|
"{\"groups\": [\"$GROUP_NAME\"]}" | jq ".result[] | .id" | tr -d '"')
|
||||||
|
|
||||||
|
## * Run validations tests one by one defined in the group.
|
||||||
|
## ::
|
||||||
|
|
||||||
|
if [ -f "{{ failed_validations_log }}" ]; then
|
||||||
|
rm -Rf "{{ failed_validations_log }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for validation_name in $LIST_VALIDATIONS; do
|
||||||
|
ID=$(openstack workflow execution create \
|
||||||
|
-f value \
|
||||||
|
-c ID \
|
||||||
|
tripleo.validations.v1.run_validation \
|
||||||
|
"{\"validation_name\": \"$validation_name\"}")
|
||||||
|
|
||||||
|
STATE=RUNNING
|
||||||
|
TRIES=0
|
||||||
|
while [ "$STATE" = RUNNING ]; do
|
||||||
|
sleep 1
|
||||||
|
STATE=$(mistral execution-get -f value -c State "$ID")
|
||||||
|
TRIES=$((TRIES+1))
|
||||||
|
if [ "$TRIES" -gt 40 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
STATUS=$(mistral execution-get-output "$ID" | jq .status -r)
|
||||||
|
if [ "$STATUS" == "FAILED" ]; then
|
||||||
|
echo "### ${validation_name} ###" | tee -a {{ failed_validations_log }}
|
||||||
|
mistral execution-get-output "$ID" | jq .stdout -r 2>&1 | tee -a {{ failed_validations_log }}
|
||||||
|
else
|
||||||
|
mistral execution-get-output "$ID" | jq .stdout -r
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
## --stop_docs
|
||||||
|
|
Loading…
Reference in New Issue