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: |
Ghanshyam Mann | 671a931 | 2023-06-28 13:37:17 -0500 | [diff] [blame] | 20 | default_concurrency: "{{ num_cores|int - 2 }}" |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 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 | |
Ghanshyam Mann | 51a5d4f | 2023-01-25 14:49:48 -0600 | [diff] [blame] | 28 | - name: Use stable branch upper-constraints till stable/wallaby |
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}) }}" |
Ghanshyam Mann | 51a5d4f | 2023-01-25 14:49:48 -0600 | [diff] [blame] | 32 | when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky", "stable/stein", "stable/train", "stable/ussuri", "stable/victoria", "stable/wallaby"] |
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 | |
Ghanshyam Mann | 7aa3b21 | 2022-05-23 20:40:57 -0500 | [diff] [blame] | 81 | - name: Tempest 26.1.0 workaround to fallback exclude-list to blacklist |
Ghanshyam Mann | d9b6d7c | 2022-05-28 18:57:54 -0500 | [diff] [blame] | 82 | # NOTE(gmann): stable/train|ussuri|victoria use Tempest 26.1.0 and with |
| 83 | # stestr 2.5.1/3.0.1 (beacause of upper constraints of stestr 2.5.1/3.0.1 |
| 84 | # in stable/train|ussuri|victoria) which does not have new args exclude-list |
| 85 | # so let's fallback to old arg if new arg is passed. |
Ghanshyam Mann | 5ff5dab | 2021-12-20 10:07:49 -0600 | [diff] [blame] | 86 | set_fact: |
| 87 | exclude_list_option: "--blacklist-file={{ tempest_test_exclude_list|quote }}" |
| 88 | when: |
| 89 | - tempest_test_exclude_list is defined |
Ghanshyam Mann | d9b6d7c | 2022-05-28 18:57:54 -0500 | [diff] [blame] | 90 | - target_branch in ["stable/train", "stable/ussuri", "stable/victoria"] |
Ghanshyam Mann | 5ff5dab | 2021-12-20 10:07:49 -0600 | [diff] [blame] | 91 | |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 92 | # TODO(kopecmartin) remove this after all consumers of the role have switched |
| 93 | # to tempest_exclude_regex option, until then it's kept here for the backward |
| 94 | # compatibility |
Martin Kopec | 8a8c85d | 2021-02-10 11:28:38 +0000 | [diff] [blame] | 95 | - name: Build exclude regex (old param) |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 96 | set_fact: |
Martin Kopec | 8a8c85d | 2021-02-10 11:28:38 +0000 | [diff] [blame] | 97 | tempest_test_exclude_regex: "--black-regex={{tempest_black_regex|quote}}" |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 98 | when: |
| 99 | - tempest_black_regex is defined |
| 100 | - tempest_exclude_regex is not defined |
| 101 | |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 102 | - name: Build exclude regex (new param) |
| 103 | set_fact: |
Martin Kopec | 8a8c85d | 2021-02-10 11:28:38 +0000 | [diff] [blame] | 104 | tempest_test_exclude_regex: "--exclude-regex={{tempest_exclude_regex|quote}}" |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 105 | when: |
| 106 | - tempest_black_regex is not defined |
| 107 | - tempest_exclude_regex is defined |
Ghanshyam Mann | d9b6d7c | 2022-05-28 18:57:54 -0500 | [diff] [blame] | 108 | - target_branch not in ["stable/train", "stable/ussuri", "stable/victoria"] |
Ghanshyam Mann | 5ff5dab | 2021-12-20 10:07:49 -0600 | [diff] [blame] | 109 | |
Ghanshyam Mann | 7aa3b21 | 2022-05-23 20:40:57 -0500 | [diff] [blame] | 110 | - name: Tempest 26.1.0 workaround to fallback exclude-regex to black-regex |
Ghanshyam Mann | d9b6d7c | 2022-05-28 18:57:54 -0500 | [diff] [blame] | 111 | # NOTE(gmann): stable/train|ussuri|victoria use Tempest 26.1.0 and with stestr |
| 112 | # 2.5.1/3.0.1 (beacause of upper constraints of stestr 2.5.1/3.0.1 in |
| 113 | # stable/train|ussuri|victoria) which does not have new args exclude-list so |
| 114 | # let's fallback to old arg if new arg is passed. |
Ghanshyam Mann | 5ff5dab | 2021-12-20 10:07:49 -0600 | [diff] [blame] | 115 | set_fact: |
| 116 | tempest_test_exclude_regex: "--black-regex={{tempest_exclude_regex|quote}}" |
| 117 | when: |
| 118 | - tempest_black_regex is not defined |
| 119 | - tempest_exclude_regex is defined |
Ghanshyam Mann | d9b6d7c | 2022-05-28 18:57:54 -0500 | [diff] [blame] | 120 | - target_branch in ["stable/train", "stable/ussuri", "stable/victoria"] |
Martin Kopec | dc84423 | 2020-12-24 15:57:53 +0000 | [diff] [blame] | 121 | |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 122 | - name: Run Tempest |
Lukáš Piwowarski | bd6481d | 2023-01-06 09:57:04 +0100 | [diff] [blame] | 123 | command: tox -e {{tox_envlist}} {{tox_extra_args}} -- \ |
| 124 | {{tempest_test_regex|quote if (tempest_test_regex|length>0)|default(None, True)}} \ |
| 125 | {{blacklist_option|default(None)}} {{exclude_list_option|default(None)}} \ |
Chandan Kumar | a944504 | 2018-02-26 10:22:29 +0000 | [diff] [blame] | 126 | --concurrency={{tempest_concurrency|default(default_concurrency)}} \ |
Lukáš Piwowarski | bd6481d | 2023-01-06 09:57:04 +0100 | [diff] [blame] | 127 | {{tempest_test_exclude_regex|default(None)}} |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 128 | args: |
| 129 | chdir: "{{devstack_base_dir}}/tempest" |
Luigi Toscano | b774666 | 2020-04-17 13:31:00 +0200 | [diff] [blame] | 130 | register: tempest_run_result |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 131 | become: true |
| 132 | become_user: tempest |
Ghanshyam | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 133 | environment: "{{ tempest_tox_environment }}" |