From c5f6368498550ad3812f26b0af28831832c21b39 Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Fri, 27 Jan 2017 16:45:20 +0100 Subject: [PATCH] Make validation HA tests atomic This commit defines a var file for each release containing the list of the HA validation tests that should be done. These new variables are now also used as booleans to determine if a test should be executed or not. With this new approach a user will be able to exclude (or include) tests at runtime, like this: ./quickstart.sh \ --retain-inventory \ ... ... --release mitaka \ --tags "overcloud-validate-ha" \ --extra-vars test_ha_failed_actions=false \ --extra-vars test_ha_master_slave=false \ --extra-vars test_ha_keystone_constraint_removal=false \ --extra-vars test_ha_instance=true \ $VIRTHOST In this case I will test just the instance deployment. This means that without any extra var tests will be the default depending on the release, otherwise specific tests will be made. It also updates the README with all these new informations. Change-Id: I113b8e929dddb9ff18b57faa905a754e2f6b5999 --- roles/validate-ha/README.md | 53 +++++++++++++-------- roles/validate-ha/tasks/main.yml | 18 ++++--- roles/validate-ha/vars/test_list_master.yml | 1 + roles/validate-ha/vars/test_list_mitaka.yml | 7 +++ roles/validate-ha/vars/test_list_newton.yml | 7 +++ roles/validate-ha/vars/test_list_ocata.yml | 7 +++ 6 files changed, 68 insertions(+), 25 deletions(-) create mode 120000 roles/validate-ha/vars/test_list_master.yml create mode 100644 roles/validate-ha/vars/test_list_mitaka.yml create mode 100644 roles/validate-ha/vars/test_list_newton.yml create mode 100644 roles/validate-ha/vars/test_list_ocata.yml diff --git a/roles/validate-ha/README.md b/roles/validate-ha/README.md index 18329d164..1c1eb7c2c 100644 --- a/roles/validate-ha/README.md +++ b/roles/validate-ha/README.md @@ -1,12 +1,12 @@ -ansible-role-tripleo-overcloud-validate-ha -========================================== +overcloud-validate-ha +===================== This role acts on an already deployed tripleo environment, testing all HA related functionalities of the installation. Requirements ------------ -This role must be used with a deployed TripleO environment, so you'll need a working directory of tripleo-quickstart with this files: +This role must be used with a deployed TripleO environment, so you'll need a working directory of tripleo-quickstart with these files: - **hosts**: which will contain all the hosts used in the deployment; - **ssh.config.ansible**: which will have all the ssh data to connect to the undercloud and all the overcloud nodes; @@ -27,7 +27,6 @@ Quickstart can be invoked like this: --retain-inventory \ --playbook overcloud-validate-ha.yml \ --working-dir /path/to/workdir \ - --requirements /path/to/quickstart-extras-requirements.txt \ --config /path/to/config.yml \ --release \ --tags all \ @@ -38,33 +37,49 @@ Basically this command: - **Keeps** existing data on the repo (it's the most important one) - Uses the *overcloud-validate-ha.yml* playbook - Uses the same custom workdir where quickstart was first deployed -- Get all the extra requirements - Select the specific config file (which must contain the floating network data) -- Specifies the release (liberty, mitaka, newton, or “master” for ocata) +- Specifies the release (mitaka, newton, or “master” for ocata) - Performs all the tasks in the playbook overcloud-validate-ha.yml -- Starts the installation on virthost **Important note** -If the role is called by itself, so not in the same playbook that already deploys the environment (see [baremetal-undercloud-validate-ha.yml](https://github.com/redhat-openstack/ansible-role-tripleo-baremetal-undercloud/blob/master/playbooks/baremetal-undercloud-validate-ha.yml), you need to export *ANSIBLE_SSH_ARGS* with the path of the *ssh.config.ansible* file, like this: +If the role is called by itself, so not in the same playbook that already deploys the environment (see [baremetal-undercloud-validate-ha.yml](https://github.com/openstack/tripleo-quickstart-extras/blob/master/playbooks/baremetal-undercloud-validate-ha.yml), you need to export *ANSIBLE_SSH_ARGS* with the path of the *ssh.config.ansible* file, like this: export ANSIBLE_SSH_ARGS="-F /path/to/quickstart/workdir/ssh.config.ansible" HA tests -------- -By default these tests are performed per version: +Each test is associated to a global variable that, if true, makes the test happen. Tests are grouped and performed by default depending on the OpenStack release. +This is the list of the supported variables, with test description and name of the release on which test is performed: -- Test: Look for failed actions (**all**) -- Test: Stop master slave resources (galera and redis), all the resources should come down (**all**) -- Test: Stop keystone resource (by stopping httpd), check no other resource is stopped (**mitaka**, **osp9**) -- Test: next generation cluster checks (**newton**): - - Test: Stop every systemd resource, stop Galera and Rabbitmq, Start every systemd resource - - Test: Stop Galera and Rabbitmq, stop every systemd resource, Start every systemd resource - - Test: Stop Galera and Rabbitmq, wait 20 minutes to see if something fails -- Test: Instance deployment (**all**) +- **test_ha_failed_actions**: Look for failed actions (**all**) +- **test_ha_master_slave**: Stop master slave resources (galera and redis), all the resources should come down (**all**) +- **test_ha_keystone_constraint_removal**: Stop keystone resource (by stopping httpd), check no other resource is stopped (**mitaka**) +- **Test: next generation cluster checks (**newton**): + - **test_ha_ng_a**: Stop every systemd resource, stop Galera and Rabbitmq, Start every systemd resource + - **test_ha_ng_b**: Stop Galera and Rabbitmq, stop every systemd resource, Start every systemd resource + - **test_ha_ng_c**: Stop Galera and Rabbitmq, wait 20 minutes to see if something fails +- **test_ha_instance**: Instance deployment (**all**) -Tests are performed using an external application named [tripleo-director-ha-test-suite](https://github.com/rscarazz/tripleo-director-ha-test-suite). +It is also possible to omit (or add) tests not made for the specific release, using the above vars, like in this example: + + ./quickstart.sh \ + --retain-inventory \ + --ansible-debug \ + --no-clone \ + --playbook overcloud-validate-ha.yml \ + --working-dir /path/to/workdir/ \ + --config /path/to/config.yml \ + --extra-vars test_ha_failed_actions=false \ + --extra-vars test_ha_ng_a=true \ + --release mitaka \ + --tags all \ + + +In this case we will not check for failed actions (which is test that otherwise will be done in mitaka) and we will force the execution of the "ng_a" test described earlier, which is originally executed just in newton versions or above. + +All tests are performed using an external application named [tripleo-director-ha-test-suite](https://github.com/rscarazz/tripleo-director-ha-test-suite). Example Playbook ---------------- @@ -78,7 +93,7 @@ The main playbook couldn't be simpler: roles: - tripleo-overcloud-validate-ha -But it could also be used at the end of a deployment, like in this file [baremetal-undercloud-validate-ha.yml](https://github.com/redhat-openstack/ansible-role-tripleo-baremetal-undercloud/blob/master/playbooks/baremetal-undercloud-validate-ha.yml). +But it could also be used at the end of a deployment, like in this file [baremetal-undercloud-validate-ha.yml](https://github.com/openstack/tripleo-quickstart-extras/blob/master/playbooks/baremetal-undercloud-validate-ha.yml). License ------- diff --git a/roles/validate-ha/tasks/main.yml b/roles/validate-ha/tasks/main.yml index 4b81ceda9..1fbac563d 100644 --- a/roles/validate-ha/tasks/main.yml +++ b/roles/validate-ha/tasks/main.yml @@ -1,6 +1,4 @@ --- -# tasks file for ansible-role-tripleo-overcloud-validate-ha - - name: Creating the environment file on undercloud delegate_to: undercloud template: @@ -31,41 +29,49 @@ - "undercloud" - "{{ groups['controller'] }}" +- name: Include test sequence depending on release + include_vars: + dir: "vars" + files_matching: "test_list_{{ release }}.yml" + - name: HA test failed actions (overcloud) delegate_to: overcloud-controller-0 shell: > {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/TD-ha-test-suite.sh -t {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/test/test_check-failed-actions > {{ overcloud_working_dir }}/test_ha_failed-actions.log 2>&1 + when: test_ha_failed_actions|bool - name: HA test Master/Slave core resource stop and start (overcloud) delegate_to: overcloud-controller-0 shell: > {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/TD-ha-test-suite.sh -t {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/test/test_master-slave -r {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/recovery/recovery_master-slave > {{ overcloud_working_dir }}/test_ha_master-slave.log 2>&1 + when: test_ha_master_slave|bool - name: HA test Keystone removal (overcloud) delegate_to: overcloud-controller-0 shell: > {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/TD-ha-test-suite.sh -t {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/test/test_keystone-constraint-removal -r {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/recovery/recovery_keystone-constraint-removal > {{ overcloud_working_dir }}/test_ha_keystone-constraint-removal.log 2>&1 - when: release == "mitaka" + when: test_ha_keystone_constraint_removal|bool - name: HA test NG A (overcloud) delegate_to: overcloud-controller-0 shell: > {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/TD-ha-test-suite.sh -t {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/test/test_pacemaker-light-a -r {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/recovery/recovery_pacemaker-light > {{ overcloud_working_dir }}/test_ha_ng-a.log 2>&1 - when: release == "newton" + when: test_ha_ng_a|bool - name: HA test NG B (overcloud) delegate_to: overcloud-controller-0 shell: > {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/TD-ha-test-suite.sh -t {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/test/test_pacemaker-light-b -r {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/recovery/recovery_pacemaker-light > {{ overcloud_working_dir }}/test_ha_ng-b.log 2>&1 - when: release == "newton" + when: test_ha_ng_b|bool - name: HA test NG C (overcloud) delegate_to: overcloud-controller-0 shell: > {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/TD-ha-test-suite.sh -t {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/test/test_pacemaker-light-c -r {{ overcloud_working_dir }}/tripleo-director-ha-test-suite/recovery/recovery_pacemaker-light > {{ overcloud_working_dir }}/test_ha_ng-c.log 2>&1 - when: release == "newton" + when: test_ha_ng_c|bool - name: HA Test instance deploy on the overcloud (undercloud) delegate_to: undercloud shell: > {{ working_dir }}/tripleo-director-ha-test-suite/TD-ha-test-suite.sh -t {{ working_dir }}/tripleo-director-ha-test-suite/test/test_instance-creation -r {{ working_dir }}/tripleo-director-ha-test-suite/recovery/recovery_instance-creation -u > {{ working_dir }}/test_ha_instance.log 2>&1 + when: test_ha_instance|bool diff --git a/roles/validate-ha/vars/test_list_master.yml b/roles/validate-ha/vars/test_list_master.yml new file mode 120000 index 000000000..f088fd5f3 --- /dev/null +++ b/roles/validate-ha/vars/test_list_master.yml @@ -0,0 +1 @@ +test_list_ocata.yml \ No newline at end of file diff --git a/roles/validate-ha/vars/test_list_mitaka.yml b/roles/validate-ha/vars/test_list_mitaka.yml new file mode 100644 index 000000000..6b80acd61 --- /dev/null +++ b/roles/validate-ha/vars/test_list_mitaka.yml @@ -0,0 +1,7 @@ +test_ha_failed_actions: true +test_ha_master_slave: true +test_ha_keystone_constraint_removal: true +test_ha_ng_a: false +test_ha_ng_b: false +test_ha_ng_c: false +test_ha_instance: true diff --git a/roles/validate-ha/vars/test_list_newton.yml b/roles/validate-ha/vars/test_list_newton.yml new file mode 100644 index 000000000..304be3f1c --- /dev/null +++ b/roles/validate-ha/vars/test_list_newton.yml @@ -0,0 +1,7 @@ +test_ha_failed_actions: true +test_ha_master_slave: true +test_ha_keystone_constraint_removal: false +test_ha_ng_a: true +test_ha_ng_b: true +test_ha_ng_c: true +test_ha_instance: true diff --git a/roles/validate-ha/vars/test_list_ocata.yml b/roles/validate-ha/vars/test_list_ocata.yml new file mode 100644 index 000000000..304be3f1c --- /dev/null +++ b/roles/validate-ha/vars/test_list_ocata.yml @@ -0,0 +1,7 @@ +test_ha_failed_actions: true +test_ha_master_slave: true +test_ha_keystone_constraint_removal: false +test_ha_ng_a: true +test_ha_ng_b: true +test_ha_ng_c: true +test_ha_instance: true