Files
tripleo-ha-utils/roles/validate-ha/tasks/main.yml
Raoul Scarazzini 54bec14470 Use Heat template to verify tests
This commit introduces the usage of heat to verify each HA test made.
The test template involves:

- Orchestration (heat);
- Volumes (cinder);
- Images (glance);
- Network, public and private (neutron);
- Server (nova);

Summary of what this commit does:

- Get rid of the workarounds;
- Get rid of undercloud options and its ha-test-suite local copy (now
  useless);
- Get rid of the old environment file needed to spawn instances;
- Get rid of instance test from ha-test-suite;
- Add Heat template verification method;

Change-Id: I2dd9d67f494717654e39c60ac5fb067afb9e1835
2018-02-02 04:51:39 -05:00

209 lines
8.8 KiB
YAML

---
- name: Include test sequence depending on release
include_vars:
dir: "vars"
files_matching: "test_list_{{ release }}.yml"
- name: Create directory on the undercloud to store test results
file: path={{ validate_ha_logs_dir }} state=directory
- name: Copy ha-test-suite on controllers
shell: >
/usr/bin/rsync --delay-updates -F --compress --archive -e 'ssh -F {{ local_working_dir }}/ssh.config.ansible' {{ local_working_dir }}/tripleo-quickstart-utils/tools/ha-test-suite {{ hostvars[item]['ansible_hostname'] }}:
delegate_to: "localhost"
with_items:
- "{{ groups['controller'] }}"
- name: Create the environment template on undercloud
template:
src: "{{ validate_ha_heat_environment }}"
dest: "{{ working_dir }}/validate-ha-heat-environment.yaml"
mode: 0600
- name: Create the test template on undercloud
template:
src: "{{ validate_ha_heat_template }}"
dest: "{{ working_dir }}/validate-ha-heat-template.yaml"
mode: 0600
- name: Download and uncompress (if necessary) image file for Heat
shell: |
image_url="{{ validate_ha_heat_instance_image_location }}"
image_file=$(basename $image_url)
curl -s -o $image_file $image_url
case "$image_file" in
*.tar)
image_name=$(tar xvf $image_file)
;;
*.tar.gz|*.tgz)
image_name=$(tar xzvf $image_file)
;;
*.tar.bz2|*.tbz2)
image_name=$(tar xjvf $image_file)
;;
*.tar.xz|*.txz)
image_name=$(tar xJf $image_file)
;;
*.bz2)
bunzip2 --force --quiet $image_file
image_name=${image_file%.*};
;;
*.gz)
gunzip --force --quiet $image_file
image_name=${image_file%.*};
;;
*.xz)
xz --force --quiet --decompress $image_file
image_name=${image_file%.*};
;;
*) image_name=$image_file
;;
esac
echo $image_name
register: image_name
- set_fact:
heat_image_name: "{{ image_name.stdout }}"
# Test: failed actions
- block:
- name: HA test - Failed actions (overcloud)
delegate_to: "{{ groups.controller[0] }}"
shell: >
{{ overcloud_working_dir }}/ha-test-suite/ha-test-suite.sh -t {{ overcloud_working_dir }}/ha-test-suite/test/test_check-failed-actions
register: test_ha_failed_actions_cmd
- include: heat-validation.yml
vars:
stack_name: "test_ha_failed_actions"
always:
- name: copy stdout test result to undercloud and check command
copy: content="{{ test_ha_failed_actions_cmd.stdout }}" dest="{{ validate_ha_logs_dir }}/test_ha_failed_actions_stdout.log"
rescue:
- name: copy stderr test result to undercloud and check command
copy: content="{{ test_ha_failed_actions_cmd.stderr }}" dest="{{ validate_ha_logs_dir }}/test_ha_failed_actions_stderr.log"
- fail: msg="{{ test_ha_failed_actions_cmd.stderr }}"
when: test_ha_failed_actions|bool
# Test: Master/Slave
- block:
- name: HA test - Master/Slave core resource stop and start (overcloud)
delegate_to: "{{ groups.controller[0] }}"
shell: >
{{ overcloud_working_dir }}/ha-test-suite/ha-test-suite.sh -t {{ overcloud_working_dir }}/ha-test-suite/test/test_master-slave -r {{ overcloud_working_dir }}/ha-test-suite/recovery/recovery_master-slave
register: test_ha_master_slave_cmd
- include: heat-validation.yml
vars:
stack_name: "test_ha_master_slave"
always:
- name: copy stdout test result to undercloud and check command
copy: content="{{ test_ha_master_slave_cmd.stdout }}" dest="{{ validate_ha_logs_dir }}/test_ha_master_slave_stdout.log"
rescue:
- name: copy stderr test result to undercloud and check command
copy: content="{{ test_ha_master_slave_cmd.stderr }}" dest="{{ validate_ha_logs_dir }}/test_ha_master_slave_stderr.log"
- fail: msg="{{ test_ha_master_slave_cmd.stderr }}"
when: test_ha_master_slave|bool
# Test: Keystone stop
- block:
- name: HA test Keystone stop (overcloud)
delegate_to: "{{ groups.controller[0] }}"
shell: >
{{ overcloud_working_dir }}/ha-test-suite/ha-test-suite.sh -t {{ overcloud_working_dir }}/ha-test-suite/test/test_keystone-constraint-removal -r {{ overcloud_working_dir }}/ha-test-suite/recovery/recovery_keystone-constraint-removal
register: test_ha_keystone_stop_cmd
- include: heat-validation.yml
vars:
stack_name: "test_ha_keystone_stop"
always:
- name: copy stdout test result to undercloud and check command
copy: content="{{ test_ha_keystone_stop_cmd.stdout }}" dest="{{ validate_ha_logs_dir }}/test_ha_keystone_stop_stdout.log"
rescue:
- name: copy stderr test result to undercloud and check command
copy: content="{{ test_ha_keystone_stop_cmd.stderr }}" dest="{{ validate_ha_logs_dir }}/test_ha_keystone_stop_stderr.log"
- fail: msg="{{ test_ha_keystone_stop_cmd.stderr }}"
when: test_ha_keystone_stop|bool
# Test: Keystone removal
- block:
- name: HA test Keystone removal (overcloud)
delegate_to: "{{ groups.controller[0] }}"
shell: >
{{ overcloud_working_dir }}/ha-test-suite/ha-test-suite.sh -t {{ overcloud_working_dir }}/ha-test-suite/test/test_keystone-constraint-removal -r {{ overcloud_working_dir }}/ha-test-suite/recovery/recovery_keystone-constraint-removal
register: test_ha_keystone_constraint_removal_cmd
- include: heat-validation.yml
vars:
stack_name: "test_ha_keystone_constraint_removal"
always:
- name: copy stdout test result to undercloud and check command
copy: content="{{ test_ha_keystone_constraint_removal_cmd.stdout }}" dest="{{ validate_ha_logs_dir }}/test_ha_keystone_constraint_removal_stdout.log"
rescue:
- name: copy stderr test result to undercloud and check command
copy: content="{{ test_ha_keystone_constraint_removal_cmd.stderr }}" dest="{{ validate_ha_logs_dir }}/test_ha_keystone_constraint_removal_stderr.log"
- fail: msg="{{ test_ha_keystone_constraint_removal_cmd.stderr }}"
when: test_ha_keystone_constraint_removal|bool
# Test: NG A
- block:
- name: HA test NG A (overcloud)
delegate_to: "{{ groups.controller[0] }}"
shell: >
{{ overcloud_working_dir }}/ha-test-suite/ha-test-suite.sh -t {{ overcloud_working_dir }}/ha-test-suite/test/test_pacemaker-light-a -r {{ overcloud_working_dir }}/ha-test-suite/recovery/recovery_pacemaker-light
register: test_ha_ng_a_cmd
- include: heat-validation.yml
vars:
stack_name: "test_ha_ng_a"
always:
- name: copy stdout test result to undercloud and check command
copy: content="{{ test_ha_ng_a_cmd.stdout }}" dest="{{ validate_ha_logs_dir }}/test_ha_ng_a_stdout.log"
rescue:
- name: copy stderr test result to undercloud and check command
copy: content="{{ test_ha_ng_a_cmd.stderr }}" dest="{{ validate_ha_logs_dir }}/test_ha_ng_a_stderr.log"
- fail: msg="{{ test_ha_ng_a_cmd.stderr }}"
when: test_ha_ng_a|bool
# Test: NG B
- block:
- name: HA test NG B (overcloud)
delegate_to: "{{ groups.controller[0] }}"
shell: >
{{ overcloud_working_dir }}/ha-test-suite/ha-test-suite.sh -t {{ overcloud_working_dir }}/ha-test-suite/test/test_pacemaker-light-b -r {{ overcloud_working_dir }}/ha-test-suite/recovery/recovery_pacemaker-light
register: test_ha_ng_b_cmd
- include: heat-validation.yml
vars:
stack_name: "test_ha_ng_b"
always:
- name: copy stdout test result to undercloud and check command
copy: content="{{ test_ha_ng_b_cmd.stdout }}" dest="{{ validate_ha_logs_dir }}/test_ha_ng_b_stdout.log"
rescue:
- name: copy stderr test result to undercloud and check command
copy: content="{{ test_ha_ng_b_cmd.stderr }}" dest="{{ validate_ha_logs_dir }}/test_ha_ng_b_stderr.log"
- fail: msg="{{ test_ha_ng_b_cmd.stderr }}"
when: test_ha_ng_b|bool
# Test: NG C
- block:
- name: HA test NG C (overcloud)
delegate_to: "{{ groups.controller[0] }}"
shell: >
{{ overcloud_working_dir }}/ha-test-suite/ha-test-suite.sh -t {{ overcloud_working_dir }}/ha-test-suite/test/test_pacemaker-light-c -r {{ overcloud_working_dir }}/ha-test-suite/recovery/recovery_pacemaker-light
register: test_ha_ng_c_cmd
- include: heat-validation.yml
vars:
stack_name: "test_ha_ng_c"
always:
- name: copy stdout test result to undercloud and check command
copy: content="{{ test_ha_ng_c_cmd.stdout }}" dest="{{ validate_ha_logs_dir }}/test_ha_ng_c_stdout.log"
rescue:
- name: copy stderr test result to undercloud and check command
copy: content="{{ test_ha_ng_c_cmd.stderr }}" dest="{{ validate_ha_logs_dir }}/test_ha_ng_c_stderr.log"
- fail: msg="{{ test_ha_ng_c_cmd.stderr }}"
when: test_ha_ng_c|bool
- name: Remove image file
file:
path: "{{ working_dir }}/{{ heat_image_name }}"
state: absent