|
| 1 | +--- |
| 2 | +- name: Run StackHPC OpenStack tests |
| 3 | + hosts: tempest_runner |
| 4 | + tags: |
| 5 | + - stackhpc-openstack-tests |
| 6 | + vars: |
| 7 | + sot_venv: "{{ virtualenv_path }}/sot-venv" |
| 8 | + sot_repo: "https://github.com/stackhpc/stackhpc-openstack-tests" |
| 9 | + sot_version: "v0.0.1" |
| 10 | + sot_timeout: 30 |
| 11 | + results_path_local: "{{ lookup('env', 'HOME') }}/sot-results" |
| 12 | + tasks: |
| 13 | + - block: |
| 14 | + - name: Create a temporary directory for tests repo |
| 15 | + ansible.builtin.tempfile: |
| 16 | + state: directory |
| 17 | + suffix: sot-repo |
| 18 | + register: repo_tmpdir |
| 19 | + |
| 20 | + - name: Create a temporary directory for results |
| 21 | + ansible.builtin.tempfile: |
| 22 | + state: directory |
| 23 | + suffix: sot-results |
| 24 | + register: results_tmpdir |
| 25 | + |
| 26 | + - name: Clone the StackHPC OpenStack tests repository |
| 27 | + ansible.builtin.git: |
| 28 | + repo: "{{ sot_repo }}" |
| 29 | + version: "{{ sot_version }}" |
| 30 | + dest: "{{ repo_tmpdir.path }}" |
| 31 | + depth: 1 |
| 32 | + single_branch: true |
| 33 | + |
| 34 | + - name: Ensure the latest versions of pip and setuptools are installed # noqa package-latest |
| 35 | + ansible.builtin.pip: |
| 36 | + name: "{{ item.name }}" |
| 37 | + state: latest |
| 38 | + virtualenv: "{{ sot_venv }}" |
| 39 | + virtualenv_command: "python3 -m venv" |
| 40 | + with_items: |
| 41 | + - { name: pip } |
| 42 | + - { name: setuptools } |
| 43 | + |
| 44 | + - name: Ensure required Python packages are installed |
| 45 | + ansible.builtin.pip: |
| 46 | + name: |
| 47 | + - "{{ repo_tmpdir.path }}" |
| 48 | + - "-r{{ repo_tmpdir.path }}/requirements.txt" |
| 49 | + - pytest-html |
| 50 | + - pytest-timeout |
| 51 | + virtualenv: "{{ sot_venv }}" |
| 52 | + |
| 53 | + - name: Include Kolla Ansible passwords |
| 54 | + ansible.builtin.include_vars: |
| 55 | + file: "{{ kayobe_env_config_path }}/kolla/passwords.yml" |
| 56 | + name: kolla_passwords |
| 57 | + |
| 58 | + - name: Run StackHPC OpenStack tests |
| 59 | + ansible.builtin.command: |
| 60 | + cmd: > |
| 61 | + {{ sot_venv }}/bin/py.test |
| 62 | + --html={{ results_tmpdir.path }}/stackhpc-openstack-tests.html |
| 63 | + --self-contained-html |
| 64 | + --pyargs stackhpc_openstack_tests |
| 65 | + --timeout {{ sot_timeout }} |
| 66 | + -vv |
| 67 | + environment: |
| 68 | + OPENSEARCH_HOSTS: "{{ sot_opensearch_hosts }}" |
| 69 | + OPENSEARCH_PORT: "{{ sot_opensearch_port }}" |
| 70 | + OPENSEARCH_TLS: "{{ sot_opensearch_tls }}" |
| 71 | + PROMETHEUS_URL: "{{ sot_prometheus_url }}" |
| 72 | + PROMETHEUS_USERNAME: "{{ sot_prometheus_username }}" |
| 73 | + PROMETHEUS_PASSWORD: "{{ sot_prometheus_password }}" |
| 74 | + vars: |
| 75 | + kolla_external_scheme: "{{ 'https' if kolla_enable_tls_external | bool else 'http' }}" |
| 76 | + kolla_internal_scheme: "{{ 'https' if kolla_enable_tls_internal | bool else 'http' }}" |
| 77 | + sot_opensearch_hosts: "{{ kolla_internal_fqdn }}" |
| 78 | + sot_opensearch_port: 9200 |
| 79 | + sot_opensearch_tls: false |
| 80 | + sot_prometheus_url: "{{ kolla_internal_scheme }}://{{ kolla_internal_fqdn }}:9091" |
| 81 | + sot_prometheus_username: "admin" |
| 82 | + sot_prometheus_password: "{{ kolla_passwords.prometheus_password }}" |
| 83 | + always: |
| 84 | + - name: Fetch results |
| 85 | + ansible.builtin.fetch: |
| 86 | + src: "{{ results_tmpdir.path }}/stackhpc-openstack-tests.html" |
| 87 | + dest: "{{ results_path_local }}/" |
| 88 | + flat: true |
| 89 | + |
| 90 | + - name: Clean up temporary directory |
| 91 | + ansible.builtin.file: |
| 92 | + path: "{{ item }}" |
| 93 | + state: absent |
| 94 | + loop: |
| 95 | + - "{{ repo_tmpdir.path }}" |
| 96 | + - "{{ results_tmpdir.path }}" |
0 commit comments