|
1 | 1 | ---
|
| 2 | +# This playbook executes tests from the StackHPC OpenStack Tests repository. |
| 3 | +# https://github.com/stackhpc/stackhpc-openstack-tests |
| 4 | + |
2 | 5 | - name: Run StackHPC OpenStack tests
|
3 |
| - hosts: tempest_runner |
| 6 | + hosts: tempest_runner:overcloud |
4 | 7 | tags:
|
5 | 8 | - stackhpc-openstack-tests
|
6 | 9 | vars:
|
|
10 | 13 | sot_timeout: 30
|
11 | 14 | results_path_local: "{{ lookup('env', 'HOME') }}/sot-results"
|
12 | 15 | tasks:
|
| 16 | + - name: Assert that there is only one host in the tempest_runner group |
| 17 | + assert: |
| 18 | + that: groups.get('tempest_runner', []) | length == 1 |
| 19 | + fail_msg: The tempest_runner group should contain exactly one host |
| 20 | + |
13 | 21 | - block:
|
14 | 22 | - name: Create a temporary directory for tests repo
|
15 | 23 | ansible.builtin.tempfile:
|
|
55 | 63 | file: "{{ kayobe_env_config_path }}/kolla/passwords.yml"
|
56 | 64 | name: kolla_passwords
|
57 | 65 |
|
58 |
| - - name: Run StackHPC OpenStack tests |
| 66 | + # Monitoring tests should run once, executed on the host in the |
| 67 | + # tempest_runner group. |
| 68 | + - name: Run StackHPC OpenStack monitoring tests |
59 | 69 | ansible.builtin.command:
|
60 | 70 | cmd: >
|
61 | 71 | {{ sot_venv }}/bin/py.test
|
62 |
| - --html={{ results_tmpdir.path }}/stackhpc-openstack-tests.html |
| 72 | + --html={{ results_tmpdir.path }}/monitoring.html |
63 | 73 | --self-contained-html
|
64 |
| - --pyargs stackhpc_openstack_tests |
| 74 | + --pyargs stackhpc_openstack_tests.monitoring |
65 | 75 | --timeout {{ sot_timeout }}
|
66 | 76 | -vv
|
67 | 77 | environment:
|
68 |
| - DOCKER_VERSION_MIN: "{{ sot_docker_version_min }}" |
69 |
| - DOCKER_VERSION_MAX: "{{ sot_docker_version_max }}" |
70 | 78 | GRAFANA_URL: "{{ sot_grafana_url }}"
|
71 | 79 | GRAFANA_USERNAME: "{{ sot_grafana_username }}"
|
72 | 80 | GRAFANA_PASSWORD: "{{ sot_grafana_password }}"
|
|
79 | 87 | PROMETHEUS_URL: "{{ sot_prometheus_url }}"
|
80 | 88 | PROMETHEUS_USERNAME: "{{ sot_prometheus_username }}"
|
81 | 89 | PROMETHEUS_PASSWORD: "{{ sot_prometheus_password }}"
|
82 |
| - SELINUX_STATE: "{{ sot_selinux_state }}" |
83 | 90 | vars:
|
84 | 91 | kolla_external_scheme: "{{ 'https' if kolla_enable_tls_external | bool else 'http' }}"
|
85 | 92 | kolla_internal_scheme: "{{ 'https' if kolla_enable_tls_internal | bool else 'http' }}"
|
86 |
| - # Inclusive min |
87 |
| - sot_docker_version_min: "24.0.0" |
88 |
| - # Exclusive max |
89 |
| - sot_docker_version_max: "27.0.0" |
90 | 93 | sot_grafana_url: "{{ kolla_external_scheme }}://{{ kolla_external_fqdn }}:3000"
|
91 | 94 | sot_grafana_username: "grafana_local_admin"
|
92 | 95 | sot_grafana_password: "{{ kolla_passwords.grafana_admin_password }}"
|
|
99 | 102 | sot_prometheus_url: "{{ kolla_internal_scheme }}://{{ kolla_internal_fqdn }}:9091"
|
100 | 103 | sot_prometheus_username: "admin"
|
101 | 104 | sot_prometheus_password: "{{ kolla_passwords.prometheus_password }}"
|
| 105 | + failed_when: monitoring_results.rc not in [0, 1] |
| 106 | + register: monitoring_results |
| 107 | + when: "'tempest_runner' in group_names" |
| 108 | + |
| 109 | + # Host tests should run on every host in the overcloud group. |
| 110 | + # TODO: Use TestInfra's native Ansible or SSH connection plugins for |
| 111 | + # remote test execution? That would place all results in a single file |
| 112 | + # and allow us to execute all tests from a single host. |
| 113 | + # https://testinfra.readthedocs.io/en/latest/backends.html#connection-backends |
| 114 | + - name: Run StackHPC OpenStack host tests |
| 115 | + ansible.builtin.command: |
| 116 | + cmd: > |
| 117 | + {{ sot_venv }}/bin/py.test |
| 118 | + --html={{ results_tmpdir.path }}/host-{{ inventory_hostname }}.html |
| 119 | + --self-contained-html |
| 120 | + --pyargs stackhpc_openstack_tests.host |
| 121 | + --timeout {{ sot_timeout }} |
| 122 | + -vv |
| 123 | + environment: |
| 124 | + DOCKER_VERSION_MIN: "{{ sot_docker_version_min }}" |
| 125 | + DOCKER_VERSION_MAX: "{{ sot_docker_version_max }}" |
| 126 | + SELINUX_STATE: "{{ sot_selinux_state }}" |
| 127 | + vars: |
| 128 | + # Inclusive min |
| 129 | + sot_docker_version_min: "24.0.0" |
| 130 | + # Exclusive max |
| 131 | + sot_docker_version_max: "27.0.0" |
102 | 132 | sot_selinux_state: "{{ selinux_state }}"
|
| 133 | + failed_when: host_results.rc not in [0, 1] |
| 134 | + register: host_results |
| 135 | + when: "'overcloud' in group_names" |
103 | 136 | always:
|
104 |
| - - name: Fetch results |
105 |
| - ansible.builtin.fetch: |
106 |
| - src: "{{ results_tmpdir.path }}/stackhpc-openstack-tests.html" |
| 137 | + - name: Synchronize results |
| 138 | + ansible.posix.synchronize: |
| 139 | + src: "{{ results_tmpdir.path }}/" |
107 | 140 | dest: "{{ results_path_local }}/"
|
108 |
| - flat: true |
| 141 | + mode: pull |
| 142 | + archive: no |
| 143 | + recursive: true |
| 144 | + # For jump host |
| 145 | + use_ssh_args: true |
| 146 | + |
| 147 | + - name: Write a file containing failed test runs |
| 148 | + ansible.builtin.copy: |
| 149 | + content: |- |
| 150 | + {% for host in ansible_play_hosts_all %} |
| 151 | + {% if host not in ansible_play_hosts %} |
| 152 | + {{ host }}: Host failure |
| 153 | + {% endif %} |
| 154 | + {% if hostvars[host].monitoring_results.rc | default(0) != 0 %} |
| 155 | + monitoring.html |
| 156 | + {% endif %} |
| 157 | + {% if hostvars[host].host_results.rc | default(0) != 0 %} |
| 158 | + host-{{ host }}.html |
| 159 | + {% endif %} |
| 160 | + {% endfor %} |
| 161 | + dest: "{{ results_path_local }}/failed-tests" |
| 162 | + delegate_to: localhost |
| 163 | + run_once: true |
109 | 164 |
|
110 | 165 | - name: Clean up temporary directory
|
111 | 166 | ansible.builtin.file:
|
|
0 commit comments