| Ghanshyam Mann | 1e4cb1d | 2021-04-21 18:25:18 -0500 | [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 }}" | 
| Ghanshyam Mann | 1e4cb1d | 2021-04-21 18:25:18 -0500 | [diff] [blame] | 21 | when: num_cores|int > 3 | 
|  | 22 |  | 
|  | 23 | - name: Override target branch | 
|  | 24 | set_fact: | 
|  | 25 | target_branch: "{{ zuul.override_checkout }}" | 
|  | 26 | when: zuul.override_checkout is defined | 
|  | 27 |  | 
|  | 28 | - name: Use stable branch upper-constraints till stable/stein | 
|  | 29 | set_fact: | 
|  | 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 | 617c84c | 2021-07-27 16:24:53 -0500 | [diff] [blame] | 32 | when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky", "stable/stein"] | 
| Ghanshyam Mann | 1e4cb1d | 2021-04-21 18:25:18 -0500 | [diff] [blame] | 33 |  | 
|  | 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' | 
|  | 43 | - devstack_localrc['TEMPEST_VENV_UPPER_CONSTRAINTS'] != 'default' | 
|  | 44 |  | 
|  | 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 |  | 
|  | 50 | - when: | 
|  | 51 | - tempest_test_blacklist is defined | 
|  | 52 | block: | 
|  | 53 | - name: Check for test blacklist file | 
|  | 54 | stat: | 
|  | 55 | path: "{{ tempest_test_blacklist }}" | 
|  | 56 | register: | 
|  | 57 | blacklist_stat | 
|  | 58 |  | 
|  | 59 | - name: Build blacklist option | 
|  | 60 | set_fact: | 
|  | 61 | blacklist_option: "--blacklist-file={{ tempest_test_blacklist|quote }}" | 
|  | 62 | when: blacklist_stat.stat.exists | 
|  | 63 |  | 
|  | 64 | - name: Run Tempest | 
| Lukáš Piwowarski | bd6481d | 2023-01-06 09:57:04 +0100 | [diff] [blame] | 65 | command: tox -e {{tox_envlist}} {{tox_extra_args}} -- \ | 
|  | 66 | {{tempest_test_regex|quote if (tempest_test_regex|length>0)|default(None, True)}} \ | 
|  | 67 | {{blacklist_option|default(None)}} \ | 
| Ghanshyam Mann | 1e4cb1d | 2021-04-21 18:25:18 -0500 | [diff] [blame] | 68 | --concurrency={{tempest_concurrency|default(default_concurrency)}} \ | 
|  | 69 | --black-regex={{tempest_black_regex|quote}} | 
|  | 70 | args: | 
|  | 71 | chdir: "{{devstack_base_dir}}/tempest" | 
|  | 72 | register: tempest_run_result | 
|  | 73 | become: true | 
|  | 74 | become_user: tempest | 
|  | 75 | environment: "{{ tempest_tox_environment }}" |