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 | |
| 28 | - name: Use stable branch upper-constraints till stable/rocky |
| 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 | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 32 | when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky"] |
| 33 | |
| 34 | - name: Set OS_TEST_TIMEOUT if requested |
| 35 | set_fact: |
| 36 | tempest_tox_environment: "{{ tempest_tox_environment | combine({'OS_TEST_TIMEOUT': tempest_test_timeout}) }}" |
| 37 | when: tempest_test_timeout != '' |
| 38 | |
Michel Peterson | ef1a16d | 2018-02-23 20:20:22 +0200 | [diff] [blame] | 39 | - when: |
| 40 | - tempest_test_blacklist is defined |
| 41 | block: |
| 42 | - name: Check for test blacklist file |
| 43 | stat: |
| 44 | path: "{{ tempest_test_blacklist }}" |
| 45 | register: |
| 46 | blacklist_stat |
| 47 | |
| 48 | - name: Build blacklist option |
| 49 | set_fact: |
| 50 | blacklist_option: "--blacklist-file={{ tempest_test_blacklist|quote }}" |
| 51 | when: blacklist_stat.stat.exists |
| 52 | |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 53 | - name: Run Tempest |
Sergey Vilgelm | 2979bff | 2018-11-06 10:34:03 -0600 | [diff] [blame] | 54 | command: tox -e {{tox_envlist}} {{tox_extra_args}} -- {{tempest_test_regex|quote}} {{blacklist_option|default('')}} \ |
Chandan Kumar | a944504 | 2018-02-26 10:22:29 +0000 | [diff] [blame] | 55 | --concurrency={{tempest_concurrency|default(default_concurrency)}} \ |
| 56 | --black-regex={{tempest_black_regex|quote}} |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 57 | args: |
| 58 | chdir: "{{devstack_base_dir}}/tempest" |
Luigi Toscano | b774666 | 2020-04-17 13:31:00 +0200 | [diff] [blame] | 59 | register: tempest_run_result |
Andrea Frittoli (andreaf) | 7d5445d | 2017-10-03 18:43:05 +0100 | [diff] [blame] | 60 | become: true |
| 61 | become_user: tempest |
Ghanshyam | 5614902 | 2020-02-05 15:53:26 -0600 | [diff] [blame] | 62 | environment: "{{ tempest_tox_environment }}" |