Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 1 | # NOTE(andreaf) The number of vcpus is not available on all systems. |
| 2 | # See https://github.com/ansible/ansible/issues/30688 |
| 3 | # When not available, we fall back to ansible_processor_cores |
| 4 | - name: Get hw.logicalcpu from sysctl |
| 5 | shell: sysctl hw.logicalcpu | cut -d' ' -f2 |
| 6 | register: sysctl_hw_logicalcpu |
| 7 | when: ansible_processor_vcpus is not defined |
| 8 | |
| 9 | - name: Number of cores |
| 10 | set_fact: |
| 11 | num_cores: "{{ansible_processor_vcpus|default(sysctl_hw_logicalcpu.stdout)}}" |
| 12 | |
| 13 | - name: Set concurrency for cores == 3 or less |
| 14 | set_fact: |
| 15 | default_concurrency: "{{ num_cores }}" |
| 16 | when: num_cores|int <= 3 |
| 17 | |
| 18 | - name: Limit max concurrency when more than 3 vcpus are available |
| 19 | set_fact: |
| 20 | default_concurrency: "{{ num_cores|int // 2 }}" |
| 21 | when: num_cores|int > 3 |
| 22 | |
Ghanshyam | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 23 | - name: Override target branch |
| 24 | set_fact: |
| 25 | target_branch: "{{ zuul.override_checkout }}" |
| 26 | when: zuul.override_checkout is defined |
| 27 | |
Riccardo Pittau | bd2acbf | 2021-02-04 11:21:29 +0100 | [diff] [blame] | 28 | - name: Use stable branch upper-constraints till stable/stein |
Ghanshyam | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 29 | set_fact: |
Andreas Jaeger | 99b085b | 2020-04-21 15:00:14 +0200 | [diff] [blame] | 30 | # TOX_CONSTRAINTS_FILE is new name, UPPER_CONSTRAINTS_FILE is old one, best to set both |
| 31 | tempest_tox_environment: "{{ tempest_tox_environment | combine({'UPPER_CONSTRAINTS_FILE': stable_constraints_file}) | combine({'TOX_CONSTRAINTS_FILE': stable_constraints_file}) }}" |
Riccardo Pittau | bd2acbf | 2021-02-04 11:21:29 +0100 | [diff] [blame] | 32 | when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky", "stable/stein"] |
Ghanshyam | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 33 | |
Ghanshyam Mann | 62d11d8 | 2021-02-10 11:41:48 -0600 | [diff] [blame] | 34 | - name: Use Configured upper-constraints for non-master Tempest |
| 35 | set_fact: |
| 36 | # TOX_CONSTRAINTS_FILE is new name, UPPER_CONSTRAINTS_FILE is old one, best to set both |
| 37 | tempest_tox_environment: "{{ tempest_tox_environment | combine({'UPPER_CONSTRAINTS_FILE': devstack_localrc['TEMPEST_VENV_UPPER_CONSTRAINTS']}) | combine({'TOX_CONSTRAINTS_FILE': devstack_localrc['TEMPEST_VENV_UPPER_CONSTRAINTS']}) }}" |
| 38 | when: |
| 39 | - devstack_localrc is defined |
| 40 | - "'TEMPEST_BRANCH' in devstack_localrc" |
| 41 | - "'TEMPEST_VENV_UPPER_CONSTRAINTS' in devstack_localrc" |
| 42 | - devstack_localrc['TEMPEST_BRANCH'] != 'master' |
Ghanshyam Mann | 926f823 | 2021-04-07 16:52:41 -0500 | [diff] [blame] | 43 | - devstack_localrc['TEMPEST_VENV_UPPER_CONSTRAINTS'] != 'master' |
Ghanshyam Mann | 62d11d8 | 2021-02-10 11:41:48 -0600 | [diff] [blame] | 44 | |
Ghanshyam | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 45 | - name: Set OS_TEST_TIMEOUT if requested |
| 46 | set_fact: |
| 47 | tempest_tox_environment: "{{ tempest_tox_environment | combine({'OS_TEST_TIMEOUT': tempest_test_timeout}) }}" |
| 48 | when: tempest_test_timeout != '' |
| 49 | |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 50 | # TODO(kopecmartin) remove the following 'when block' after all consumers of |
| 51 | # the role have switched to tempest_test_exclude_list option, until then it's |
| 52 | # kept here for backward compatibility |
Michel Peterson | ef1a16d | 2018-02-23 20:20:22 +0200 | [diff] [blame] | 53 | - when: |
| 54 | - tempest_test_blacklist is defined |
| 55 | block: |
| 56 | - name: Check for test blacklist file |
| 57 | stat: |
| 58 | path: "{{ tempest_test_blacklist }}" |
| 59 | register: |
| 60 | blacklist_stat |
| 61 | |
| 62 | - name: Build blacklist option |
| 63 | set_fact: |
| 64 | blacklist_option: "--blacklist-file={{ tempest_test_blacklist|quote }}" |
| 65 | when: blacklist_stat.stat.exists |
| 66 | |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 67 | - when: |
| 68 | - tempest_test_exclude_list is defined |
| 69 | block: |
| 70 | - name: Check for test exclude list file |
| 71 | stat: |
| 72 | path: "{{ tempest_test_exclude_list }}" |
| 73 | register: |
| 74 | exclude_list_stat |
| 75 | |
| 76 | - name: Build exclude list option |
| 77 | set_fact: |
| 78 | exclude_list_option: "--exclude-list={{ tempest_test_exclude_list|quote }}" |
| 79 | when: exclude_list_stat.stat.exists |
| 80 | |
| 81 | # TODO(kopecmartin) remove this after all consumers of the role have switched |
| 82 | # to tempest_exclude_regex option, until then it's kept here for the backward |
| 83 | # compatibility |
Martin Kopec | 8a8c85d | 2021-02-10 11:28:38 +0000 | [diff] [blame] | 84 | - name: Build exclude regex (old param) |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 85 | set_fact: |
Martin Kopec | 8a8c85d | 2021-02-10 11:28:38 +0000 | [diff] [blame] | 86 | tempest_test_exclude_regex: "--black-regex={{tempest_black_regex|quote}}" |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 87 | when: |
| 88 | - tempest_black_regex is defined |
| 89 | - tempest_exclude_regex is not defined |
| 90 | |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 91 | - name: Build exclude regex (new param) |
| 92 | set_fact: |
Martin Kopec | 8a8c85d | 2021-02-10 11:28:38 +0000 | [diff] [blame] | 93 | tempest_test_exclude_regex: "--exclude-regex={{tempest_exclude_regex|quote}}" |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 94 | when: |
| 95 | - tempest_black_regex is not defined |
| 96 | - tempest_exclude_regex is defined |
| 97 | |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 98 | - name: Run Tempest |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 99 | command: tox -e {{tox_envlist}} {{tox_extra_args}} -- {{tempest_test_regex|quote}} \ |
| 100 | {{blacklist_option|default('')}} {{exclude_list_option|default('')}} \ |
Chandan Kumar | a944504 | 2018-02-26 10:22:29 +0000 | [diff] [blame] | 101 | --concurrency={{tempest_concurrency|default(default_concurrency)}} \ |
Martin Kopec | 8a8c85d | 2021-02-10 11:28:38 +0000 | [diff] [blame] | 102 | {{tempest_test_exclude_regex|default('')}} |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 103 | args: |
| 104 | chdir: "{{devstack_base_dir}}/tempest" |
Luigi Toscano | b774666 | 2020-04-17 13:31:00 +0200 | [diff] [blame] | 105 | register: tempest_run_result |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 106 | become: true |
| 107 | become_user: tempest |
Ghanshyam | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 108 | environment: "{{ tempest_tox_environment }}" |