blob: b68507a0b8a751e4dbd9f5c101052e7436f6f76a [file] [log] [blame]
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +01001# 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
Michel Petersonef1a16d2018-02-23 20:20:22 +020023- when:
24 - tempest_test_blacklist is defined
25 block:
26 - name: Check for test blacklist file
27 stat:
28 path: "{{ tempest_test_blacklist }}"
29 register:
30 blacklist_stat
31
32 - name: Build blacklist option
33 set_fact:
34 blacklist_option: "--blacklist-file={{ tempest_test_blacklist|quote }}"
35 when: blacklist_stat.stat.exists
36
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010037- name: Run Tempest
Michel Petersonef1a16d2018-02-23 20:20:22 +020038 command: tox -e {{tox_envlist}} -- {{tempest_test_regex|quote}} {{blacklist_option|default('')}} --concurrency={{tempest_concurrency|default(default_concurrency)}}
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010039 args:
40 chdir: "{{devstack_base_dir}}/tempest"
41 become: true
42 become_user: tempest